Commit includes ControlLoopPolicy API and bugfixes
[policy/engine.git] / POLICY-SDK-APP / src / main / java / org / openecomp / policy / controller / PolicyRolesController.java
index 8209077..2193420 100644 (file)
@@ -31,6 +31,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.rest.dao.CommonClassDao;
 import org.openecomp.policy.rest.jpa.PolicyEditorScopes;
 import org.openecomp.policy.rest.jpa.PolicyRoles;
@@ -53,6 +55,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 @RequestMapping("/")
 public class PolicyRolesController extends RestrictedBaseController{
        
+       private static final Logger LOGGER      = FlexLogger.getLogger(PolicyRolesController.class);
+       
        @Autowired
        CommonClassDao commonClassDao;
        
@@ -61,7 +65,7 @@ public class PolicyRolesController extends RestrictedBaseController{
        @RequestMapping(value={"/get_RolesData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getPolicyRolesEntityData(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("rolesDatas", mapper.writeValueAsString(commonClassDao.getUserRoles()));
                        JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -69,7 +73,7 @@ public class PolicyRolesController extends RestrictedBaseController{
                        response.getWriter().write(j.toString());
                }
                catch (Exception e){
-                       e.printStackTrace();
+                       LOGGER.error("Exception Occured"+e);
                }
        }
        
@@ -105,7 +109,7 @@ public class PolicyRolesController extends RestrictedBaseController{
                        out.write(j.toString());
                }
                catch (Exception e){
-                       e.printStackTrace();
+                       LOGGER.error("Exception Occured"+e);
                }
                return null;
        }
@@ -113,8 +117,8 @@ public class PolicyRolesController extends RestrictedBaseController{
        @RequestMapping(value={"/get_PolicyRolesScopeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
        public void getPolicyScopesEntityData(HttpServletRequest request, HttpServletResponse response){
                try{
-                       scopelist = new ArrayList<String>();
-                       Map<String, Object> model = new HashMap<String, Object>();
+                       scopelist = new ArrayList<>();
+                       Map<String, Object> model = new HashMap<>();
                        ObjectMapper mapper = new ObjectMapper();
                        mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
                        List<String> scopesData = commonClassDao.getDataByColumn(PolicyEditorScopes.class, "scopeName");
@@ -124,7 +128,7 @@ public class PolicyRolesController extends RestrictedBaseController{
                        response.getWriter().write(j.toString());
                }
                catch (Exception e){
-                       e.printStackTrace();
+                       LOGGER.error("Exception Occured"+e);
                }
        }
 }