[Policy-52, Policy-92, Policy-93] Policy Enhancements and bugfixes
[policy/engine.git] / ECOMP-PAP-REST / src / main / java / org / openecomp / policy / pap / xacml / rest / controller / DictionaryController.java
index c08bba6..b01f9b0 100644 (file)
@@ -22,6 +22,7 @@ package org.openecomp.policy.pap.xacml.rest.controller;
 
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -87,7 +88,7 @@ public class DictionaryController {
        public void getAttributeDictionaryEntityDatabyAttributeName(HttpServletRequest request, HttpServletResponse response){
                try{
                        System.out.println();
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("attributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(Attribute.class, "xacmlId")));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -104,7 +105,7 @@ public class DictionaryController {
        public void getAttributeDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
                        System.out.println();
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("attributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(Attribute.class)));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -204,6 +205,7 @@ public class DictionaryController {
                        }else{
                                if(!isFakeUpdate) {
                                        attributeData.setUserModifiedBy(this.getUserInfo(userId));
+                                       attributeData.setModifiedDate(new Date());
                                        commonClassDao.update(attributeData); 
                                }
                        } 
@@ -278,7 +280,7 @@ public class DictionaryController {
        public void getEcompNameDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
                LOGGER.info("get_EcompNameDataByName is called");
                try{
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        model.put("ecompNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(EcompName.class, "ecompName")));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -293,7 +295,7 @@ public class DictionaryController {
        @RequestMapping(value={"/get_EcompNameData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getEcompNameDictionaryEntityData(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("ecompNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(EcompName.class)));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -357,6 +359,7 @@ public class DictionaryController {
                        }else{
                                if(!isFakeUpdate){
                                        ecompData.setUserModifiedBy(this.getUserInfo(userId));
+                                       ecompData.setModifiedDate(new Date());
                                        commonClassDao.update(ecompData);
                                }
                        }