[POLICY-122] Policy GUI Fixes
[policy/engine.git] / ECOMP-PAP-REST / src / main / java / org / openecomp / policy / pap / xacml / rest / controller / ClosedLoopDictionaryController.java
index 26d9a65..f97d846 100644 (file)
@@ -21,6 +21,7 @@
 package org.openecomp.policy.pap.xacml.rest.controller;
 
 import java.io.PrintWriter;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -76,7 +77,7 @@ public class ClosedLoopDictionaryController{
        @RequestMapping(value={"/get_VSCLActionDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getVSCLActionDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VSCLAction.class, "vsclaction")));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -92,7 +93,7 @@ public class ClosedLoopDictionaryController{
        @RequestMapping(value={"/get_VSCLActionData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getVSCLActionDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class)));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -111,7 +112,7 @@ public class ClosedLoopDictionaryController{
        @RequestMapping(value={"/get_VNFTypeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getVNFTypeDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VNFType.class, "vnftype")));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -128,7 +129,7 @@ public class ClosedLoopDictionaryController{
        @RequestMapping(value={"/get_VNFTypeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getVNFTypeDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VNFType.class)));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -147,7 +148,7 @@ public class ClosedLoopDictionaryController{
        @RequestMapping(value={"/get_PEPOptionsDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getPEPOptionsDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PEPOptions.class, "pepName")));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -162,7 +163,7 @@ public class ClosedLoopDictionaryController{
        @RequestMapping(value={"/get_PEPOptionsData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getPEPOptionsDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PEPOptions.class)));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -181,7 +182,7 @@ public class ClosedLoopDictionaryController{
        @RequestMapping(value={"/get_VarbindDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getVarbindDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("varbindDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VarbindDictionary.class, "varbindName")));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -196,7 +197,7 @@ public class ClosedLoopDictionaryController{
        @RequestMapping(value={"/get_VarbindDictionaryData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getVarbindDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("varbindDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VarbindDictionary.class)));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -215,7 +216,7 @@ public class ClosedLoopDictionaryController{
        @RequestMapping(value={"/get_ClosedLoopServicesDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getClosedLoopServiceDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ClosedLoopD2Services.class, "serviceName")));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -230,7 +231,7 @@ public class ClosedLoopDictionaryController{
        @RequestMapping(value={"/get_ClosedLoopServicesData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getClosedLoopServiceDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ClosedLoopD2Services.class)));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -249,7 +250,7 @@ public class ClosedLoopDictionaryController{
        @RequestMapping(value={"/get_ClosedLoopSiteDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getClosedLoopSiteDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("closedLoopSiteDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ClosedLoopSite.class, "siteName")));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -264,7 +265,7 @@ public class ClosedLoopDictionaryController{
        @RequestMapping(value={"/get_ClosedLoopSiteData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getClosedLoopSiteDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("closedLoopSiteDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ClosedLoopSite.class)));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -325,6 +326,7 @@ public class ClosedLoopDictionaryController{
                                }else{
                                        vSCLAction.setUserCreatedBy(this.getUserInfo(userId));
                                        vSCLAction.setUserModifiedBy(this.getUserInfo(userId));
+                                       vSCLAction.setModifiedDate(new Date());
                                        commonClassDao.save(vSCLAction);
                                }
                        }else{
@@ -453,6 +455,7 @@ public class ClosedLoopDictionaryController{
                        }else{
                                if(!isFakeUpdate) {
                                        vNFType.setUserModifiedBy(this.getUserInfo(userId));
+                                       vNFType.setModifiedDate(new Date());
                                        commonClassDao.update(vNFType); 
                                }
                        } 
@@ -592,6 +595,7 @@ public class ClosedLoopDictionaryController{
                        }else{
                                if(!isFakeUpdate){
                                        pEPOptions.setUserModifiedBy(this.getUserInfo(userId));
+                                       pEPOptions.setModifiedDate(new Date());
                                        commonClassDao.update(pEPOptions);
                                }
                        }
@@ -712,6 +716,7 @@ public class ClosedLoopDictionaryController{
                        }else{
                                if(!isFakeUpdate){
                                        serviceData.setUserModifiedBy(this.getUserInfo(userId));
+                                       serviceData.setModifiedDate(new Date());
                                        commonClassDao.update(serviceData); 
                                }
                        }
@@ -830,6 +835,7 @@ public class ClosedLoopDictionaryController{
                        }else{
                                if(!isFakeUpdate) {
                                        siteData.setUserModifiedBy(this.getUserInfo(userId));
+                                       siteData.setModifiedDate(new Date());
                                        commonClassDao.update(siteData);
                                }
                        }
@@ -949,6 +955,7 @@ public class ClosedLoopDictionaryController{
                        }else{
                                if(!isFakeUpdate){
                                        varbindDictionary.setUserModifiedBy(this.getUserInfo(userId));
+                                       varbindDictionary.setModifiedDate(new Date());
                                        commonClassDao.update(varbindDictionary);
                                }
                        }