Merge "Added Junits for ONAP-PAP-REST"
[policy/engine.git] / ONAP-PAP-REST / src / main / java / org / onap / policy / pap / xacml / rest / controller / ClosedLoopDictionaryController.java
index d142a46..a55ed40 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-PAP-REST
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ import org.json.JSONObject;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 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.JsonMessage;
 import org.onap.policy.rest.dao.CommonClassDao;
 import org.onap.policy.rest.jpa.ClosedLoopD2Services;
@@ -44,6 +45,7 @@ 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.VarbindDictionary;
+import org.onap.policy.utils.PolicyUtils;
 import org.onap.policy.xacml.api.XACMLErrorConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
@@ -86,6 +88,10 @@ public class ClosedLoopDictionaryController{
        public ClosedLoopDictionaryController(CommonClassDao commonClassDao){
                ClosedLoopDictionaryController.commonClassDao = commonClassDao;
        }
+       
+       public void setCommonClassDao(CommonClassDao commonClassDao){
+               ClosedLoopDictionaryController.commonClassDao = commonClassDao;
+       }
        /*
         * This is an empty constructor
         */
@@ -391,7 +397,7 @@ public class ClosedLoopDictionaryController{
                        response.setCharacterEncoding(utf8);
                        request.setCharacterEncoding(utf8);
                        PrintWriter out = response.getWriter();
-                       out.write(e.getMessage());
+                       out.write(PolicyUtils.CATCH_EXCEPTION);
                }
                return null;
        }
@@ -421,7 +427,7 @@ public class ClosedLoopDictionaryController{
                        response.setCharacterEncoding(utf8);
                        request.setCharacterEncoding(utf8);
                        PrintWriter out = response.getWriter();
-                       out.write(e.getMessage());
+                       out.write(PolicyUtils.CATCH_EXCEPTION);
                }
                return null;
        }
@@ -512,7 +518,7 @@ public class ClosedLoopDictionaryController{
                        response.setCharacterEncoding(utf8);
                        request.setCharacterEncoding(utf8);
                        PrintWriter out = response.getWriter();
-                       out.write(e.getMessage());
+                       out.write(PolicyUtils.CATCH_EXCEPTION);
                }
                return null;
        }
@@ -542,7 +548,7 @@ public class ClosedLoopDictionaryController{
                        response.setCharacterEncoding(utf8);
                        request.setCharacterEncoding(utf8);
                        PrintWriter out = response.getWriter();
-                       out.write(e.getMessage());
+                       out.write(PolicyUtils.CATCH_EXCEPTION);
                }
                return null;
        }
@@ -652,7 +658,7 @@ public class ClosedLoopDictionaryController{
                        response.setCharacterEncoding(utf8);
                        request.setCharacterEncoding(utf8);
                        PrintWriter out = response.getWriter();
-                       out.write(e.getMessage());
+                       out.write(PolicyUtils.CATCH_EXCEPTION);
                }
                return null;
        }
@@ -682,7 +688,7 @@ public class ClosedLoopDictionaryController{
                        response.setCharacterEncoding(utf8);
                        request.setCharacterEncoding(utf8);
                        PrintWriter out = response.getWriter();
-                       out.write(e.getMessage());
+                       out.write(PolicyUtils.CATCH_EXCEPTION);
                }
                return null;
        }
@@ -770,7 +776,7 @@ public class ClosedLoopDictionaryController{
                        response.setCharacterEncoding(utf8);
                        request.setCharacterEncoding(utf8);
                        PrintWriter out = response.getWriter();
-                       out.write(e.getMessage());
+                       out.write(PolicyUtils.CATCH_EXCEPTION);
                }
                return null;
        }
@@ -800,7 +806,7 @@ public class ClosedLoopDictionaryController{
                        response.setCharacterEncoding(utf8);
                        request.setCharacterEncoding(utf8);
                        PrintWriter out = response.getWriter();
-                       out.write(e.getMessage());
+                       out.write(PolicyUtils.CATCH_EXCEPTION);
                }
                return null;
        }
@@ -889,7 +895,7 @@ public class ClosedLoopDictionaryController{
                        response.setCharacterEncoding(utf8);
                        request.setCharacterEncoding(utf8);
                        PrintWriter out = response.getWriter();
-                       out.write(e.getMessage());
+                       out.write(PolicyUtils.CATCH_EXCEPTION);
                }
                return null;
        }
@@ -919,7 +925,7 @@ public class ClosedLoopDictionaryController{
                        response.setCharacterEncoding(utf8);
                        request.setCharacterEncoding(utf8);
                        PrintWriter out = response.getWriter();
-                       out.write(e.getMessage());
+                       out.write(PolicyUtils.CATCH_EXCEPTION);
                }
                return null;
        }
@@ -1008,7 +1014,7 @@ public class ClosedLoopDictionaryController{
                        response.setCharacterEncoding(utf8);
                        request.setCharacterEncoding(utf8);
                        PrintWriter out = response.getWriter();
-                       out.write(e.getMessage());
+                       out.write(PolicyUtils.CATCH_EXCEPTION);
                }
                return null;
        }
@@ -1038,10 +1044,14 @@ public class ClosedLoopDictionaryController{
                        response.setCharacterEncoding(utf8);
                        request.setCharacterEncoding(utf8);
                        PrintWriter out = response.getWriter();
-                       out.write(e.getMessage());
+                       out.write(PolicyUtils.CATCH_EXCEPTION);
                }
                return null;
        }
+       
+    public static void setCommonClassDao(CommonClassDaoImpl commonClassDaoImpl) {
+        commonClassDao = commonClassDaoImpl;
+    }
 
 }