String literal comparision on left side 91/13891/9
authorrama-huawei <rama.subba.reddy.s@huawei.com>
Wed, 20 Sep 2017 13:24:26 +0000 (18:54 +0530)
committerRama SubbaReddy <rama.subba.reddy.s@huawei.com>
Thu, 21 Sep 2017 12:37:23 +0000 (12:37 +0000)
Issue-ID: POLICY-239
Change-Id: Iee03160b28ffadb296f3926c7d7c5ac98fac535e
Signed-off-by: rama-huawei <rama.subba.reddy.s@huawei.com>
POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java
POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java

index d70f199..32f40b9 100644 (file)
@@ -59,5 +59,11 @@ public class HibernateSession{
        public static Session getSession(){
                return logSessionFactory.openSession();
        }
+       
+       public static void setSession(SessionFactory logSessionFactory1){
+               logSessionFactory = logSessionFactory1;
+       }
 
+       private HibernateSession(){
+       }
 }
index f10041e..392adf0 100644 (file)
@@ -98,24 +98,24 @@ public class CreateClosedLoopPMController{
                                                                                String attributeId = designator.getAttributeId();
 
                                                                                // First match in the target is OnapName, so set that value.
-                                                                               if (attributeId.equals("ONAPName")) {
+                                                                               if ("ONAPName".equals(attributeId)) {
                                                                                        policyAdapter.setOnapName(value);
                                                                                }
-                                                                               if (attributeId.equals("RiskType")){
+                                                                               if ("RiskType".equals(attributeId)){
                                                                                        policyAdapter.setRiskType(value);
                                                                                }
-                                                                               if (attributeId.equals("RiskLevel")){
+                                                                               if ("RiskLevel".equals(attributeId)){
                                                                                        policyAdapter.setRiskLevel(value);
                                                                                }
-                                                                               if (attributeId.equals("guard")){
+                                                                               if ("guard".equals(attributeId)){
                                                                                        policyAdapter.setGuard(value);
                                                                                }
-                                                                               if (attributeId.equals("TTLDate") && !value.contains("NA")){
+                                                                               if ("TTLDate".equals(attributeId) && !value.contains("NA")){
                                                                                        PolicyController controller = new PolicyController();
                                                                                        String newDate = controller.convertDate(value);
                                                                                        policyAdapter.setTtlDate(newDate);
                                                                                }
-                                                                               if (attributeId.equals("ServiceType")){
+                                                                               if ("ServiceType".equals(attributeId)){
                                                                                        LinkedHashMap<String, String> serviceTypePolicyName1 = new LinkedHashMap<>();
                                                                                        String key = "serviceTypePolicyName";
                                                                                        serviceTypePolicyName1.put(key, value);