Enhancement to use the common CryptoUtils
[policy/engine.git] / POLICY-SDK-APP / src / main / java / org / onap / policy / controller / PolicyController.java
index 7df8602..700aa3a 100644 (file)
@@ -4,6 +4,7 @@
  * ================================================================================
  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
  * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
+ * Modifications Copyright (C) 2019 Bell Canada
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -37,7 +38,6 @@ import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
 import javax.annotation.PostConstruct;
-import javax.mail.MessagingException;
 import javax.script.SimpleBindings;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -59,6 +59,7 @@ import org.onap.policy.rest.jpa.FunctionDefinition;
 import org.onap.policy.rest.jpa.PolicyEntity;
 import org.onap.policy.rest.jpa.PolicyVersion;
 import org.onap.policy.rest.jpa.UserInfo;
+import org.onap.policy.utils.PeCryptoUtils;
 import org.onap.policy.utils.UserUtils.Pair;
 import org.onap.policy.xacml.api.XACMLErrorConstants;
 import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
@@ -209,12 +210,12 @@ public class PolicyController extends RestrictedBaseController {
             setLogdbDriver(prop.getProperty("xacml.log.db.driver"));
             setLogdbUrl(prop.getProperty("xacml.log.db.url"));
             setLogdbUserName(prop.getProperty("xacml.log.db.user"));
-            setLogdbPassword(prop.getProperty("xacml.log.db.password"));
+            setLogdbPassword(PeCryptoUtils.decrypt(prop.getProperty("xacml.log.db.password")));
             setLogdbDialect(prop.getProperty("onap.dialect"));
             // Xacml Database Properties
             setXacmldbUrl(prop.getProperty("javax.persistence.jdbc.url"));
             setXacmldbUserName(prop.getProperty("javax.persistence.jdbc.user"));
-            setXacmldbPassword(prop.getProperty("javax.persistence.jdbc.password"));
+            setXacmldbPassword(PeCryptoUtils.decrypt(prop.getProperty("javax.persistence.jdbc.password")));
             // AutoPuh
             setAutoPushAvailable(prop.getProperty("xacml.automatic.push"));
             setAutoPushDSClosedLoop(prop.getProperty("xacml.autopush.closedloop"));
@@ -597,12 +598,7 @@ public class PolicyController extends RestrictedBaseController {
      */
     public void watchPolicyFunction(PolicyVersion entity, String policyName, String mode) {
         PolicyNotificationMail email = new PolicyNotificationMail();
-        try {
-            email.sendMail(entity, policyName, mode, commonClassDao);
-        } catch (MessagingException e) {
-            policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR
-                    + "Excepton Occured while Renaming/Deleting a Policy or Scope" + e);
-        }
+        email.sendMail(entity, policyName, mode, commonClassDao);
     }
 
     /**