-
- public ClosedLoopDictionaryController(){
- super();
- }
-
- private DictionaryUtils getDictionaryUtilsInstance(){
- return DictionaryUtils.dictionaryUtils != null ? DictionaryUtils.getDictionaryUtils() : new DictionaryUtils();
- }
-
- @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);
- }
-
-
- @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);
- }
-
- @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);
- }
-
- @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);
- }
-
- @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);
- }
-
- @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);
- }
-
- @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} , 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} , 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} , 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} , 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} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getClosedLoopSiteDictionaryEntityData(HttpServletResponse response){
- DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getData(response, closedLoopSiteDatas, ClosedLoopSite.class);
- }
-
- @RequestMapping(value={"/cl_dictionary/save_vsclAction"}, method={RequestMethod.POST})
- 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;
- String userId = null;
- if (fromAPI) {
- vSCLAction = mapper.readValue(root.get(dictionaryFields).toString(), VSCLAction.class);
- userId = "API";
- } else {
- 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);
- boolean duplicateflag = false;
- if(!duplicateData.isEmpty()){
- 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()))){
- duplicateflag = true;
- }
- }
- String responseString = null;
- if(!duplicateflag){
- vSCLAction.setUserModifiedBy(userInfo);
- if(vSCLAction.getId() == 0){
- vSCLAction.setUserCreatedBy(userInfo);
- commonClassDao.save(vSCLAction);
- }else{
- vSCLAction.setModifiedDate(new Date());
- commonClassDao.update(vSCLAction);
- }
- responseString = mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class));
- }else{
- responseString = duplicateResponseString;
- }
-
- if(fromAPI){
- return utils.getResultForApi(responseString);
- }else{
- utils.setResponseData(response, vsclActionDatas, responseString);
- }
- }catch(Exception e){
- utils.setErrorResponseData(response, e);
- }
- return null;
- }
-
- @RequestMapping(value={"/cl_dictionary/remove_VsclAction"}, method={RequestMethod.POST})
- 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{
- 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;
- String userId = null;
- if (fromAPI) {
- vNFType = mapper.readValue(root.get(dictionaryFields).toString(), VNFType.class);
- userId = "API";
- } else {
- 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);
- boolean duplicateflag = false;
- if(!duplicateData.isEmpty()){
- 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()))){
- duplicateflag = true;
- }
- }
- String responseString = null;
- if(!duplicateflag){
- vNFType.setUserModifiedBy(userInfo);
- if(vNFType.getId() == 0){
- vNFType.setUserCreatedBy(userInfo);
- commonClassDao.save(vNFType);
- }else{
- vNFType.setModifiedDate(new Date());
- commonClassDao.update(vNFType);
- }
- responseString = mapper.writeValueAsString(commonClassDao.getData(VNFType.class));
- }else{
- responseString = duplicateResponseString;
- }
-
- if(fromAPI){
- return utils.getResultForApi(responseString);
- }else{
- utils.setResponseData(response, vnfTypeDatas, responseString);
- }
- }catch(Exception e){
- utils.setErrorResponseData(response, e);
- }
- return null;
- }
-
- @RequestMapping(value={"/cl_dictionary/remove_vnfType"}, method={RequestMethod.POST})
- public void removeVnfType(HttpServletRequest request, HttpServletResponse response) throws IOException {
- DictionaryUtils utils = getDictionaryUtilsInstance();
- 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{
- 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());
+
+ public ClosedLoopDictionaryController() {
+ super();
+ }
+
+ private DictionaryUtils getDictionaryUtilsInstance() {
+ return DictionaryUtils.getDictionaryUtils();
+ }
+
+ @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);
+ }
+
+
+ @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);
+ }
+
+ @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);
+ }
+
+ @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);
+ }
+
+ @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);
+ }
+
+ @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);
+ }
+
+ @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},
+ 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},
+ 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},
+ 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},
+ 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},
+ produces = MediaType.APPLICATION_JSON_VALUE)
+ public void getClosedLoopSiteDictionaryEntityData(HttpServletResponse response) {
+ DictionaryUtils utils = getDictionaryUtilsInstance();
+ utils.getData(response, closedLoopSiteDatas, ClosedLoopSite.class);
+ }
+
+ @RequestMapping(value = {"/cl_dictionary/save_vsclAction"}, method = {RequestMethod.POST})
+ 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;
+ String userId = null;
+ if (fromAPI) {
+ vSCLAction =
+ mapper.readValue(root.get(dictionaryFields).toString(), VSCLAction.class);
+ userId = "API";
+ } else {
+ 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);
+ boolean duplicateflag = false;
+ if (!duplicateData.isEmpty()) {
+ 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()))) {
+ duplicateflag = true;
+ }
+ }
+ String responseString = null;
+ if (!duplicateflag) {
+ vSCLAction.setUserModifiedBy(userInfo);
+ if (vSCLAction.getId() == 0) {
+ vSCLAction.setUserCreatedBy(userInfo);
+ commonClassDao.save(vSCLAction);
+ } else {
+ vSCLAction.setModifiedDate(new Date());
+ commonClassDao.update(vSCLAction);
+ }
+ responseString =
+ mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class));
+ } else {
+ responseString = duplicateResponseString;
+ }
+
+ if (fromAPI) {
+ return utils.getResultForApi(responseString);
+ } else {
+ utils.setResponseData(response, vsclActionDatas, responseString);
+ }
+ } catch (Exception e) {
+ utils.setErrorResponseData(response, e);
+ }
+ return null;
+ }
+
+ @RequestMapping(value = {"/cl_dictionary/remove_VsclAction"}, method = {RequestMethod.POST})
+ 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 {
+ 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;
+ String userId = null;
+ if (fromAPI) {
+ vNFType = mapper.readValue(root.get(dictionaryFields).toString(), VNFType.class);
+ userId = "API";
+ } else {
+ 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);
+ boolean duplicateflag = false;
+ if (!duplicateData.isEmpty()) {
+ 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()))) {
+ duplicateflag = true;
+ }
+ }
+ String responseString = null;
+ if (!duplicateflag) {
+ vNFType.setUserModifiedBy(userInfo);
+ if (vNFType.getId() == 0) {
+ vNFType.setUserCreatedBy(userInfo);
+ commonClassDao.save(vNFType);
+ } else {
+ vNFType.setModifiedDate(new Date());
+ commonClassDao.update(vNFType);
+ }
+ responseString = mapper.writeValueAsString(commonClassDao.getData(VNFType.class));
+ } else {
+ responseString = duplicateResponseString;
+ }
+
+ if (fromAPI) {
+ return utils.getResultForApi(responseString);
+ } else {
+ utils.setResponseData(response, vnfTypeDatas, responseString);
+ }
+ } catch (Exception e) {
+ utils.setErrorResponseData(response, e);
+ }
+ return null;
+ }
+
+ @RequestMapping(value = {"/cl_dictionary/remove_vnfType"}, method = {RequestMethod.POST})
+ public void removeVnfType(HttpServletRequest request, HttpServletResponse response)
+ throws IOException {
+ DictionaryUtils utils = getDictionaryUtilsInstance();
+ 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 {
+ 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());