Technical debt reduction
[policy/engine.git] / PolicyEngineAPI / src / main / java / org / onap / policy / std / ManualClientEndUEB.java
index dcd86eb..c04736e 100644 (file)
@@ -51,35 +51,37 @@ public class ManualClientEndUEB {
        private static String url = null;
        private static String uniquID = null;
        private static String topic = null;
-       
+
+       private ManualClientEndUEB() {
+               // Empty constructor
+       }
 
        public static PDPNotification result(NotificationScheme scheme) {
                if (resultJson == null || notification == null) {
                        logger.debug("No Result" );
                        return null;
-               } else {
-                       if(scheme.equals(NotificationScheme.MANUAL_ALL_NOTIFICATIONS)) {
-                               boolean removed = false, updated = false; 
-                               if(notification.getRemovedPolicies()!=null && !notification.getRemovedPolicies().isEmpty()){
-                                       removed = true;
-                               }
-                               if(notification.getLoadedPolicies()!=null && !notification.getLoadedPolicies().isEmpty()){
-                                       updated = true;
-                               }
-                               if(removed && updated) {
-                                       notification.setNotificationType(NotificationType.BOTH);
-                               }else if(removed){
-                                       notification.setNotificationType(NotificationType.REMOVE);
-                               }else if(updated){
-                                       notification.setNotificationType(NotificationType.UPDATE);
-                               }
-                               return notification;
-                       }else if(scheme.equals(NotificationScheme.MANUAL_NOTIFICATIONS)) {
-                               return MatchStore.checkMatch(notification);
-                       }else {
-                               return null;
+               }
+               if(scheme.equals(NotificationScheme.MANUAL_ALL_NOTIFICATIONS)) {
+                       boolean removed = false;
+                       boolean updated = false; 
+                       if(notification.getRemovedPolicies()!=null && !notification.getRemovedPolicies().isEmpty()){
+                               removed = true;
+                       }
+                       if(notification.getLoadedPolicies()!=null && !notification.getLoadedPolicies().isEmpty()){
+                               updated = true;
+                       }
+                       if(removed && updated) {
+                               notification.setNotificationType(NotificationType.BOTH);
+                       }else if(removed){
+                               notification.setNotificationType(NotificationType.REMOVE);
+                       }else if(updated){
+                               notification.setNotificationType(NotificationType.UPDATE);
                        }
+                       return notification;
+               }else if(scheme.equals(NotificationScheme.MANUAL_NOTIFICATIONS)) {
+                       return MatchStore.checkMatch(notification);
                }
+               return null;
        }
 
        private static void publishMessage(String pubTopic, String uniqueID , List<String> uebURLList) {
@@ -145,13 +147,12 @@ public class ManualClientEndUEB {
                                                logger.debug("Manual Notification Recieved Message " + msg + " from UEB cluster : " + uebURLList.toString());
                                                resultJson = msg;
                                                if (!msg.contains("UEB Update")){
-//                                                     System.out.println("Manual Notification Recieved Message " + msg + " from UEB cluster : " + uebURLList.toString());
                                                        notification = NotificationUnMarshal.notificationJSON(msg);
                                                        count = 4;
                                                }
                                        }
                                }catch (Exception e) {
-                                       
+                                       logger.error("Error in Manual CLient UEB notification ", e);
                                } 
                                count++;
                        }