aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java250
1 files changed, 118 insertions, 132 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
index 2aec0cc0d..9ea956aa7 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
@@ -23,11 +23,14 @@ package org.onap.policy.pap.xacml.rest.controller;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+
import java.io.IOException;
import java.util.Date;
import java.util.List;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
import org.onap.policy.pap.xacml.rest.adapters.GridData;
import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
import org.onap.policy.pap.xacml.rest.util.DictionaryUtils;
@@ -35,10 +38,10 @@ import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.ClosedLoopD2Services;
import org.onap.policy.rest.jpa.ClosedLoopSite;
import org.onap.policy.rest.jpa.OnapName;
-import org.onap.policy.rest.jpa.PEPOptions;
+import org.onap.policy.rest.jpa.PepOptions;
import org.onap.policy.rest.jpa.UserInfo;
-import org.onap.policy.rest.jpa.VNFType;
-import org.onap.policy.rest.jpa.VSCLAction;
+import org.onap.policy.rest.jpa.VnfType;
+import org.onap.policy.rest.jpa.VsclAction;
import org.onap.policy.rest.jpa.VarbindDictionary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
@@ -51,9 +54,9 @@ import org.springframework.web.servlet.ModelAndView;
public class ClosedLoopDictionaryController {
private static CommonClassDao commonClassDao;
- private static String vsclaction = "vsclaction";
+ private static String vsclaction = "action";
private static String operation = "operation";
- private static String vnftype = "vnftype";
+ private static String vnftype = "type";
private static String pepName = "pepName";
private static String varbindName = "varbindName";
private static String serviceName = "serviceName";
@@ -89,85 +92,108 @@ public class ClosedLoopDictionaryController {
return DictionaryUtils.getDictionaryUtils();
}
- @RequestMapping(value = {"/get_VSCLActionDataByName"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_VSCLActionDataByName"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getVSCLActionDictionaryByNameEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getDataByEntity(response, vsclActionDatas, vsclaction, VSCLAction.class);
+ utils.getDataByEntity(response, vsclActionDatas, vsclaction, VsclAction.class);
}
-
- @RequestMapping(value = {"/get_VSCLActionData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_VSCLActionData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getVSCLActionDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getData(response, vsclActionDatas, VSCLAction.class);
+ utils.getData(response, vsclActionDatas, VsclAction.class);
}
- @RequestMapping(value = {"/get_VNFTypeDataByName"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_VNFTypeDataByName"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getVNFTypeDictionaryByNameEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getDataByEntity(response, vnfTypeDatas, vnftype, VNFType.class);
+ utils.getDataByEntity(response, vnfTypeDatas, vnftype, VnfType.class);
}
- @RequestMapping(value = {"/get_VNFTypeData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_VNFTypeData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getVNFTypeDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getData(response, vnfTypeDatas, VNFType.class);
+ utils.getData(response, vnfTypeDatas, VnfType.class);
}
- @RequestMapping(value = {"/get_PEPOptionsDataByName"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_PEPOptionsDataByName"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getPEPOptionsDictionaryByNameEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getDataByEntity(response, pepOptionDatas, pepName, PEPOptions.class);
+ utils.getDataByEntity(response, pepOptionDatas, pepName, PepOptions.class);
}
- @RequestMapping(value = {"/get_PEPOptionsData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_PEPOptionsData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getPEPOptionsDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getData(response, pepOptionDatas, PEPOptions.class);
+ utils.getData(response, pepOptionDatas, PepOptions.class);
}
- @RequestMapping(value = {"/get_VarbindDictionaryDataByName"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_VarbindDictionaryDataByName"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getVarbindDictionaryByNameEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getDataByEntity(response, varbindDatas, varbindName, VarbindDictionary.class);
}
- @RequestMapping(value = {"/get_VarbindDictionaryData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_VarbindDictionaryData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getVarbindDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getData(response, varbindDatas, VarbindDictionary.class);
}
- @RequestMapping(value = {"/get_ClosedLoopServicesDataByName"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_ClosedLoopServicesDataByName"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getClosedLoopServiceDictionaryByNameEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getDataByEntity(response, closedLoopDatas, serviceName, ClosedLoopD2Services.class);
}
- @RequestMapping(value = {"/get_ClosedLoopServicesData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_ClosedLoopServicesData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getClosedLoopServiceDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getData(response, closedLoopDatas, ClosedLoopD2Services.class);
}
- @RequestMapping(value = {"/get_ClosedLoopSiteDataByName"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_ClosedLoopSiteDataByName"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getClosedLoopSiteDictionaryByNameEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getDataByEntity(response, closedLoopSiteDatas, siteName, ClosedLoopSite.class);
}
- @RequestMapping(value = {"/get_ClosedLoopSiteData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_ClosedLoopSiteData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getClosedLoopSiteDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
@@ -175,39 +201,34 @@ public class ClosedLoopDictionaryController {
}
@RequestMapping(value = {"/cl_dictionary/save_vsclAction"}, method = {RequestMethod.POST})
- public ModelAndView saveVSCLAction(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ public ModelAndView saveVSCLAction(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
try {
boolean fromAPI = utils.isRequestFromAPI(request);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
- VSCLAction vSCLAction;
+ VsclAction vSCLAction;
String userId = null;
if (fromAPI) {
- vSCLAction =
- mapper.readValue(root.get(dictionaryFields).toString(), VSCLAction.class);
+ vSCLAction = mapper.readValue(root.get(dictionaryFields).toString(), VsclAction.class);
userId = "API";
} else {
- vSCLAction = mapper.readValue(root.get("vsclActionDictionaryData").toString(),
- VSCLAction.class);
+ vSCLAction = mapper.readValue(root.get("vsclActionDictionaryData").toString(), VsclAction.class);
userId = root.get(userid).textValue();
}
UserInfo userInfo = utils.getUserInfo(userId);
- List<Object> duplicateData = commonClassDao
- .checkDuplicateEntry(vSCLAction.getVsclaction(), vsclaction, VSCLAction.class);
+ List<Object> duplicateData =
+ commonClassDao.checkDuplicateEntry(vSCLAction.getAction(), vsclaction, VsclAction.class);
boolean duplicateflag = false;
if (!duplicateData.isEmpty()) {
- VSCLAction data = (VSCLAction) duplicateData.get(0);
- if (request.getParameter(operation) != null
- && "update".equals(request.getParameter(operation))) {
+ VsclAction data = (VsclAction) duplicateData.get(0);
+ if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
vSCLAction.setId(data.getId());
} else if ((request.getParameter(operation) != null
&& !"update".equals(request.getParameter(operation)))
- || (request.getParameter(operation) == null
- && (data.getId() != vSCLAction.getId()))) {
+ || (request.getParameter(operation) == null && (data.getId() != vSCLAction.getId()))) {
duplicateflag = true;
}
}
@@ -221,8 +242,7 @@ public class ClosedLoopDictionaryController {
vSCLAction.setModifiedDate(new Date());
commonClassDao.update(vSCLAction);
}
- responseString =
- mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class));
+ responseString = mapper.writeValueAsString(commonClassDao.getData(VsclAction.class));
} else {
responseString = duplicateResponseString;
}
@@ -239,45 +259,40 @@ public class ClosedLoopDictionaryController {
}
@RequestMapping(value = {"/cl_dictionary/remove_VsclAction"}, method = {RequestMethod.POST})
- public void removeVSCLAction(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ public void removeVSCLAction(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.removeData(request, response, vsclActionDatas, OnapName.class);
}
@RequestMapping(value = {"/cl_dictionary/save_vnfType"}, method = {RequestMethod.POST})
- public ModelAndView saveVnfType(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ public ModelAndView saveVnfType(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
try {
boolean fromAPI = utils.isRequestFromAPI(request);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
- VNFType vNFType;
+ VnfType vNFType;
String userId = null;
if (fromAPI) {
- vNFType = mapper.readValue(root.get(dictionaryFields).toString(), VNFType.class);
+ vNFType = mapper.readValue(root.get(dictionaryFields).toString(), VnfType.class);
userId = "API";
} else {
- vNFType = mapper.readValue(root.get("vnfTypeDictionaryData").toString(),
- VNFType.class);
+ vNFType = mapper.readValue(root.get("vnfTypeDictionaryData").toString(), VnfType.class);
userId = root.get(userid).textValue();
}
UserInfo userInfo = utils.getUserInfo(userId);
- List<Object> duplicateData = commonClassDao.checkDuplicateEntry(vNFType.getVnftype(),
- vnftype, VNFType.class);
+ List<Object> duplicateData =
+ commonClassDao.checkDuplicateEntry(vNFType.getType(), vnftype, VnfType.class);
boolean duplicateflag = false;
if (!duplicateData.isEmpty()) {
- VNFType data = (VNFType) duplicateData.get(0);
- if (request.getParameter(operation) != null
- && "update".equals(request.getParameter(operation))) {
+ VnfType data = (VnfType) duplicateData.get(0);
+ if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
vNFType.setId(data.getId());
} else if ((request.getParameter(operation) != null
&& !"update".equals(request.getParameter(operation)))
- || (request.getParameter(operation) == null
- && (data.getId() != vNFType.getId()))) {
+ || (request.getParameter(operation) == null && (data.getId() != vNFType.getId()))) {
duplicateflag = true;
}
}
@@ -291,7 +306,7 @@ public class ClosedLoopDictionaryController {
vNFType.setModifiedDate(new Date());
commonClassDao.update(vNFType);
}
- responseString = mapper.writeValueAsString(commonClassDao.getData(VNFType.class));
+ responseString = mapper.writeValueAsString(commonClassDao.getData(VnfType.class));
} else {
responseString = duplicateResponseString;
}
@@ -308,34 +323,29 @@ public class ClosedLoopDictionaryController {
}
@RequestMapping(value = {"/cl_dictionary/remove_vnfType"}, method = {RequestMethod.POST})
- public void removeVnfType(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ public void removeVnfType(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.removeData(request, response, vnfTypeDatas, VNFType.class);
+ utils.removeData(request, response, vnfTypeDatas, VnfType.class);
}
@RequestMapping(value = {"/cl_dictionary/save_pepOptions"}, method = {RequestMethod.POST})
- public ModelAndView savePEPOptions(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ public ModelAndView savePEPOptions(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
try {
boolean fromAPI = utils.isRequestFromAPI(request);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
- PEPOptions pEPOptions;
+ PepOptions pEPOptions;
GridData gridData;
String userId = null;
if (fromAPI) {
- pEPOptions =
- mapper.readValue(root.get(dictionaryFields).toString(), PEPOptions.class);
+ pEPOptions = mapper.readValue(root.get(dictionaryFields).toString(), PepOptions.class);
gridData = mapper.readValue(root.get(dictionaryFields).toString(), GridData.class);
userId = "API";
} else {
- pEPOptions = mapper.readValue(root.get("pepOptionsDictionaryData").toString(),
- PEPOptions.class);
- gridData = mapper.readValue(root.get("pepOptionsDictionaryData").toString(),
- GridData.class);
+ pEPOptions = mapper.readValue(root.get("pepOptionsDictionaryData").toString(), PepOptions.class);
+ gridData = mapper.readValue(root.get("pepOptionsDictionaryData").toString(), GridData.class);
userId = root.get(userid).textValue();
}
UserInfo userInfo = utils.getUserInfo(userId);
@@ -344,18 +354,16 @@ public class ClosedLoopDictionaryController {
pEPOptions.setActions(utils.appendKeyValue(gridData.getAttributes(), ":#@", "=#@"));
}
- List<Object> duplicateData = commonClassDao.checkDuplicateEntry(pEPOptions.getPepName(),
- pepName, PEPOptions.class);
+ List<Object> duplicateData =
+ commonClassDao.checkDuplicateEntry(pEPOptions.getPepName(), pepName, PepOptions.class);
boolean duplicateflag = false;
if (!duplicateData.isEmpty()) {
- PEPOptions data = (PEPOptions) duplicateData.get(0);
- if (request.getParameter(operation) != null
- && "update".equals(request.getParameter(operation))) {
+ PepOptions data = (PepOptions) duplicateData.get(0);
+ if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
pEPOptions.setId(data.getId());
} else if ((request.getParameter(operation) != null
&& !"update".equals(request.getParameter(operation)))
- || (request.getParameter(operation) == null
- && (data.getId() != pEPOptions.getId()))) {
+ || (request.getParameter(operation) == null && (data.getId() != pEPOptions.getId()))) {
duplicateflag = true;
}
}
@@ -369,8 +377,7 @@ public class ClosedLoopDictionaryController {
pEPOptions.setModifiedDate(new Date());
commonClassDao.update(pEPOptions);
}
- responseString =
- mapper.writeValueAsString(commonClassDao.getData(PEPOptions.class));
+ responseString = mapper.writeValueAsString(commonClassDao.getData(PepOptions.class));
} else {
responseString = duplicateResponseString;
}
@@ -387,15 +394,13 @@ public class ClosedLoopDictionaryController {
}
@RequestMapping(value = {"/cl_dictionary/remove_pepOptions"}, method = {RequestMethod.POST})
- public void removePEPOptions(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ public void removePEPOptions(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.removeData(request, response, pepOptionDatas, VNFType.class);
+ utils.removeData(request, response, pepOptionDatas, VnfType.class);
}
@RequestMapping(value = {"/cl_dictionary/save_service"}, method = {RequestMethod.POST})
- public ModelAndView saveServiceType(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ public ModelAndView saveServiceType(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
try {
boolean fromAPI = utils.isRequestFromAPI(request);
@@ -405,29 +410,25 @@ public class ClosedLoopDictionaryController {
ClosedLoopD2Services serviceData;
String userId = null;
if (fromAPI) {
- serviceData = mapper.readValue(root.get(dictionaryFields).toString(),
- ClosedLoopD2Services.class);
+ serviceData = mapper.readValue(root.get(dictionaryFields).toString(), ClosedLoopD2Services.class);
userId = "API";
} else {
- serviceData =
- mapper.readValue(root.get("closedLoopServiceDictionaryData").toString(),
- ClosedLoopD2Services.class);
+ serviceData = mapper.readValue(root.get("closedLoopServiceDictionaryData").toString(),
+ ClosedLoopD2Services.class);
userId = root.get(userid).textValue();
}
UserInfo userInfo = utils.getUserInfo(userId);
- List<Object> duplicateData = commonClassDao.checkDuplicateEntry(
- serviceData.getServiceName(), serviceName, ClosedLoopD2Services.class);
+ List<Object> duplicateData = commonClassDao.checkDuplicateEntry(serviceData.getServiceName(), serviceName,
+ ClosedLoopD2Services.class);
boolean duplicateflag = false;
if (!duplicateData.isEmpty()) {
ClosedLoopD2Services data = (ClosedLoopD2Services) duplicateData.get(0);
- if (request.getParameter(operation) != null
- && "update".equals(request.getParameter(operation))) {
+ if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
serviceData.setId(data.getId());
} else if ((request.getParameter(operation) != null
&& !"update".equals(request.getParameter(operation)))
- || (request.getParameter(operation) == null
- && (data.getId() != serviceData.getId()))) {
+ || (request.getParameter(operation) == null && (data.getId() != serviceData.getId()))) {
duplicateflag = true;
}
}
@@ -441,8 +442,7 @@ public class ClosedLoopDictionaryController {
serviceData.setModifiedDate(new Date());
commonClassDao.update(serviceData);
}
- responseString = mapper
- .writeValueAsString(commonClassDao.getData(ClosedLoopD2Services.class));
+ responseString = mapper.writeValueAsString(commonClassDao.getData(ClosedLoopD2Services.class));
} else {
responseString = duplicateResponseString;
}
@@ -458,15 +458,13 @@ public class ClosedLoopDictionaryController {
}
@RequestMapping(value = {"/cl_dictionary/remove_Service"}, method = {RequestMethod.POST})
- public void removeServiceType(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ public void removeServiceType(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.removeData(request, response, closedLoopDatas, VNFType.class);
+ utils.removeData(request, response, closedLoopDatas, VnfType.class);
}
@RequestMapping(value = {"/cl_dictionary/save_siteName"}, method = {RequestMethod.POST})
- public ModelAndView saveSiteType(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ public ModelAndView saveSiteType(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
try {
boolean fromAPI = utils.isRequestFromAPI(request);
@@ -476,28 +474,24 @@ public class ClosedLoopDictionaryController {
ClosedLoopSite siteData;
String userId = null;
if (fromAPI) {
- siteData = mapper.readValue(root.get(dictionaryFields).toString(),
- ClosedLoopSite.class);
+ siteData = mapper.readValue(root.get(dictionaryFields).toString(), ClosedLoopSite.class);
userId = "API";
} else {
- siteData = mapper.readValue(root.get("closedLoopSiteDictionaryData").toString(),
- ClosedLoopSite.class);
+ siteData = mapper.readValue(root.get("closedLoopSiteDictionaryData").toString(), ClosedLoopSite.class);
userId = root.get(userid).textValue();
}
UserInfo userInfo = utils.getUserInfo(userId);
- List<Object> duplicateData = commonClassDao.checkDuplicateEntry(siteData.getSiteName(),
- siteName, ClosedLoopSite.class);
+ List<Object> duplicateData =
+ commonClassDao.checkDuplicateEntry(siteData.getSiteName(), siteName, ClosedLoopSite.class);
boolean duplicateflag = false;
if (!duplicateData.isEmpty()) {
ClosedLoopSite data = (ClosedLoopSite) duplicateData.get(0);
- if (request.getParameter(operation) != null
- && "update".equals(request.getParameter(operation))) {
+ if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
siteData.setId(data.getId());
} else if ((request.getParameter(operation) != null
&& !"update".equals(request.getParameter(operation)))
- || (request.getParameter(operation) == null
- && (data.getId() != siteData.getId()))) {
+ || (request.getParameter(operation) == null && (data.getId() != siteData.getId()))) {
duplicateflag = true;
}
}
@@ -511,8 +505,7 @@ public class ClosedLoopDictionaryController {
siteData.setModifiedDate(new Date());
commonClassDao.update(siteData);
}
- responseString =
- mapper.writeValueAsString(commonClassDao.getData(ClosedLoopSite.class));
+ responseString = mapper.writeValueAsString(commonClassDao.getData(ClosedLoopSite.class));
} else {
responseString = duplicateResponseString;
}
@@ -528,15 +521,13 @@ public class ClosedLoopDictionaryController {
}
@RequestMapping(value = {"/cl_dictionary/remove_site"}, method = {RequestMethod.POST})
- public void removeSiteType(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ public void removeSiteType(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.removeData(request, response, closedLoopSiteDatas, VNFType.class);
+ utils.removeData(request, response, closedLoopSiteDatas, VnfType.class);
}
@RequestMapping(value = {"/cl_dictionary/save_varbind"}, method = {RequestMethod.POST})
- public ModelAndView saveVarbind(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ public ModelAndView saveVarbind(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
try {
boolean fromAPI = utils.isRequestFromAPI(request);
@@ -546,28 +537,25 @@ public class ClosedLoopDictionaryController {
VarbindDictionary varbindDictionary;
String userId = null;
if (fromAPI) {
- varbindDictionary = mapper.readValue(root.get(dictionaryFields).toString(),
- VarbindDictionary.class);
+ varbindDictionary = mapper.readValue(root.get(dictionaryFields).toString(), VarbindDictionary.class);
userId = "API";
} else {
- varbindDictionary = mapper.readValue(root.get("varbindDictionaryData").toString(),
- VarbindDictionary.class);
+ varbindDictionary =
+ mapper.readValue(root.get("varbindDictionaryData").toString(), VarbindDictionary.class);
userId = root.get(userid).textValue();
}
UserInfo userInfo = utils.getUserInfo(userId);
- List<Object> duplicateData = commonClassDao.checkDuplicateEntry(
- varbindDictionary.getVarbindName(), varbindName, VarbindDictionary.class);
+ List<Object> duplicateData = commonClassDao.checkDuplicateEntry(varbindDictionary.getVarbindName(),
+ varbindName, VarbindDictionary.class);
boolean duplicateflag = false;
if (!duplicateData.isEmpty()) {
VarbindDictionary data = (VarbindDictionary) duplicateData.get(0);
- if (request.getParameter(operation) != null
- && "update".equals(request.getParameter(operation))) {
+ if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
varbindDictionary.setId(data.getId());
} else if ((request.getParameter(operation) != null
&& !"update".equals(request.getParameter(operation)))
- || (request.getParameter(operation) == null
- && (data.getId() != varbindDictionary.getId()))) {
+ || (request.getParameter(operation) == null && (data.getId() != varbindDictionary.getId()))) {
duplicateflag = true;
}
}
@@ -582,8 +570,7 @@ public class ClosedLoopDictionaryController {
varbindDictionary.setModifiedDate(new Date());
commonClassDao.update(varbindDictionary);
}
- responseString =
- mapper.writeValueAsString(commonClassDao.getData(VarbindDictionary.class));
+ responseString = mapper.writeValueAsString(commonClassDao.getData(VarbindDictionary.class));
} else {
responseString = duplicateResponseString;
}
@@ -599,9 +586,8 @@ public class ClosedLoopDictionaryController {
}
@RequestMapping(value = {"/cl_dictionary/remove_varbindDict"}, method = {RequestMethod.POST})
- public void removeVarbind(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ public void removeVarbind(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.removeData(request, response, varbindDatas, VNFType.class);
+ utils.removeData(request, response, varbindDatas, VnfType.class);
}
}