Use lombok annotations in IM and ONAP logging 13/122013/2
authorJim Hahn <jrh3@att.com>
Thu, 17 Jun 2021 14:32:25 +0000 (10:32 -0400)
committerJim Hahn <jrh3@att.com>
Thu, 17 Jun 2021 15:15:29 +0000 (11:15 -0400)
Issue-ID: POLICY-3394
Change-Id: I25db6b4b13bad8754889eaedb93197cae7d27c4d
Signed-off-by: Jim Hahn <jrh3@att.com>
20 files changed:
common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingUtils.java
common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java
common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventData.java
common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfo.java
common-logging/src/main/java/org/onap/policy/common/logging/eelf/OnapConfigProperties.java
common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java
common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/DisplayUtils.java
common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/EelfLogger.java
common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java
common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/SystemOutLogger.java
common-logging/src/main/java/org/onap/policy/common/logging/nsa/LoggingContextFactory.java
integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java
integrity-monitor/src/main/java/org/onap/policy/common/im/MonitorTime.java
integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java
integrity-monitor/src/main/java/org/onap/policy/common/im/StateElement.java
integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java
integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java
integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java
integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java

index 1550cc9..842b477 100644 (file)
@@ -22,16 +22,15 @@ package org.onap.policy.common.logging;
 
 import com.google.re2j.Pattern;
 import javax.servlet.http.HttpServletRequest;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 
-public class OnapLoggingUtils {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class OnapLoggingUtils {
 
     private static final Pattern COMMA_PAT = Pattern.compile(",");
     private static final Pattern CURLS_PAT = Pattern.compile("[{][}]");
 
-    private OnapLoggingUtils() {
-        // Private constructor to prevent subclassing
-    }
-
     /**
      * Get the ONAPLoggingContext for a request.
      *
index 32bb6fe..9e46191 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-Logging
  * ================================================================================
- * Copyright (C) 2020 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 2020-2021 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.
@@ -21,6 +21,8 @@
 package org.onap.policy.common.logging.eelf;
 
 import java.util.EnumMap;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 
 /**
  * ErrorCodeMap contains a HashMap of ErrorCodeInfo (error code and error description).
@@ -32,7 +34,8 @@ import java.util.EnumMap;
  * 500 – business process errors
  * 900 – unknown errors
  */
-public class ErrorCodeMap {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ErrorCodeMap {
 
     private static final EnumMap<MessageCodes, ErrorCodeInfo> hm = new EnumMap<>(MessageCodes.class);
 
@@ -93,10 +96,6 @@ public class ErrorCodeMap {
         hm.put(MessageCodes.ERROR_AUDIT, new ErrorCodeInfo(ERROR_AUDIT, ERROR_AUDIT_DESCRIPTION));
     }
 
-    private ErrorCodeMap() {
-        // Private constructor to prevent subclassing
-    }
-
     public static ErrorCodeInfo getErrorCodeInfo(MessageCodes messageCode) {
         return hm.get(messageCode);
     }
index 0240399..87a96a1 100644 (file)
@@ -21,7 +21,9 @@
 package org.onap.policy.common.logging.eelf;
 
 import java.time.Instant;
+import lombok.AllArgsConstructor;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 import lombok.Setter;
 
 /**
@@ -29,32 +31,14 @@ import lombok.Setter;
  */
 @Getter
 @Setter
+@NoArgsConstructor
+@AllArgsConstructor
 public class EventData {
 
     private String requestId = null;
     private Instant startTime = null;
     private Instant endTime = null;
 
-    // Default constructor takes no arguments.
-    // Is empty because instance variables are assigned
-    // their default values upon declaration.
-    public EventData() {
-        // See above comments for the reason this constructor is empty
-    }
-
-    /**
-     * Create an instance.
-     *
-     * @param requestId the request ID
-     * @param startTime the start time
-     * @param endTime the end time
-     */
-    public EventData(String requestId, Instant startTime, Instant endTime) {
-        this.requestId = requestId;
-        this.startTime = startTime;
-        this.endTime = endTime;
-    }
-
     @Override
     public String toString() {
         return requestId + " Starting Time : " + this.startTime + " Ending Time : " + this.endTime;
index 3e02116..f6f38d0 100644 (file)
@@ -22,12 +22,14 @@ package org.onap.policy.common.logging.eelf;
 
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import lombok.Getter;
 
 /**
  * EventTrackInfo contains a ConcurrentHashMap of EventData.
  */
 public class EventTrackInfo {
 
+    @Getter
     private final ConcurrentMap<String, EventData> eventInfo;
 
     /**
@@ -80,11 +82,4 @@ public class EventTrackInfo {
             eventInfo.remove(eventId);
         }
     }
-
-    /**
-     * Returns a ConcurrentHashMap of EventData.
-     */
-    public ConcurrentMap<String, EventData> getEventInfo() {
-        return eventInfo;
-    }
 }
index 47c027c..d71ebe5 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-Logging
  * ================================================================================
- * Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 2020-2021 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.
 
 package org.onap.policy.common.logging.eelf;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 
-public class OnapConfigProperties {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class OnapConfigProperties {
 
     /**
      * The Date-time of the start of a transaction.
@@ -81,8 +84,4 @@ public class OnapConfigProperties {
     public static final String SERVER_NAME = "ServerName";
 
     public static final String INVOCATION_ID = "InvocationID";
-
-    private OnapConfigProperties() {
-        // do nothing
-    }
 }
index 1565956..662ca76 100644 (file)
@@ -61,6 +61,10 @@ import java.util.Timer;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentMap;
 import java.util.function.Consumer;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
 import org.apache.commons.lang3.StringUtils;
 import org.onap.policy.common.logging.OnapLoggingUtils;
 import org.onap.policy.common.logging.flexlogger.LoggerType;
@@ -69,6 +73,7 @@ import org.slf4j.MDC;
 /**
  * PolicyLogger contains all the static methods for EELF logging.
  */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class PolicyLogger {
 
     private static EELFLogger errorLogger = EELFManager.getErrorLogger();
@@ -110,7 +115,9 @@ public class PolicyLogger {
     // size drops to this point, stop the Timer
     private static int stopCheckPoint = 2500;
 
-    private static boolean isOverrideLogbackLevel = false;
+    @Getter
+    @Setter
+    private static boolean overrideLogbackLevel = false;
 
     private static Level debugLevel = Level.INFO;
     private static Level auditLevel = Level.INFO;
@@ -133,10 +140,6 @@ public class PolicyLogger {
         }
     }
 
-    private PolicyLogger() {
-
-    }
-
     public static synchronized Level getDebugLevel() {
         return debugLevel;
     }
@@ -150,7 +153,7 @@ public class PolicyLogger {
      */
     public static synchronized void setDebugLevel(String newDebugLevel) {
 
-        if (isOverrideLogbackLevel) {
+        if (overrideLogbackLevel) {
             PolicyLogger.debugLevel = Level.valueOf(newDebugLevel);
             debugLogger.setLevel(debugLevel);
         }
@@ -170,7 +173,7 @@ public class PolicyLogger {
      */
     public static synchronized void setAuditLevel(String newAuditLevel) {
 
-        if (isOverrideLogbackLevel) {
+        if (overrideLogbackLevel) {
             if ("OFF".equalsIgnoreCase(newAuditLevel)) {
                 PolicyLogger.auditLevel = Level.OFF;
                 auditLogger.setLevel(auditLevel);
@@ -195,7 +198,7 @@ public class PolicyLogger {
      */
     public static synchronized void setMetricsLevel(String newMetricsLevel) {
 
-        if (isOverrideLogbackLevel) {
+        if (overrideLogbackLevel) {
             if ("OFF".equalsIgnoreCase(newMetricsLevel)) {
                 PolicyLogger.metricsLevel = Level.OFF;
                 metricsLogger.setLevel(metricsLevel);
@@ -221,7 +224,7 @@ public class PolicyLogger {
      */
     public static synchronized void setErrorLevel(String newErrorLevel) {
 
-        if (isOverrideLogbackLevel) {
+        if (overrideLogbackLevel) {
             if ("OFF".equalsIgnoreCase(newErrorLevel)) {
                 PolicyLogger.errorLevel = Level.OFF;
                 errorLogger.setLevel(errorLevel);
@@ -1373,10 +1376,10 @@ public class PolicyLogger {
     }
 
     private static void setOverrideLogbackLevels(Properties loggerProperties) {
-        final String overrideLogbackLevel = loggerProperties.getProperty("override.logback.level.setup");
+        final var overrideLogbackLevelText = loggerProperties.getProperty("override.logback.level.setup");
 
-        if (!StringUtils.isBlank(overrideLogbackLevel)) {
-            isOverrideLogbackLevel = "TRUE".equalsIgnoreCase(overrideLogbackLevel);
+        if (!StringUtils.isBlank(overrideLogbackLevelText)) {
+            overrideLogbackLevel = "TRUE".equalsIgnoreCase(overrideLogbackLevelText);
         }
     }
 
@@ -1395,24 +1398,6 @@ public class PolicyLogger {
         }
     }
 
-
-    /**
-     * Returns true for overriding logback levels; returns false for not.
-     */
-    public static boolean isOverrideLogbackLevel() {
-
-        return isOverrideLogbackLevel;
-    }
-
-    /**
-     * Sets true for overriding logback levels; sets false for not.
-     */
-    public static void setOverrideLogbackLevel(boolean odl) {
-
-        isOverrideLogbackLevel = odl;
-
-    }
-
     /**
      * Sets server information to MDC.
      */
index 6cc5dc1..425c62a 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 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.
 
 package org.onap.policy.common.logging.flexlogger;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
 /**
  * Utilities to display messages. These are generally used while logging is being
  * configured, or when logging being directed to System.out. As a result, it directly
  * writes to System.out rather than to a logger.
  */
-public class DisplayUtils {
 
-    private DisplayUtils() {
-        // do nothing
-    }
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class DisplayUtils {
 
     /*
      * As the comment above says, these purposely write to System.out rather than a
index 837a584..0e0ef2b 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-Logging
  * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 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.
@@ -23,6 +23,7 @@ package org.onap.policy.common.logging.flexlogger;
 import com.att.eelf.configuration.EELFLogger.Level;
 import java.io.Serializable;
 import java.util.UUID;
+import lombok.Getter;
 import org.onap.policy.common.logging.eelf.MessageCodes;
 import org.onap.policy.common.logging.eelf.PolicyLogger;
 
@@ -34,6 +35,7 @@ public class EelfLogger implements Logger, Serializable {
 
     private static final long serialVersionUID = 5385586713941277192L;
     private String className = "";
+    @Getter
     private String transId = UUID.randomUUID().toString();
 
     /**
@@ -134,14 +136,6 @@ public class EelfLogger implements Logger, Serializable {
         this.transId = transId;
     }
 
-    /**
-     * Returns transaction Id for logging.
-     */
-    @Override
-    public String getTransId() {
-        return transId;
-    }
-
     /**
      * Records a message.
      *
index ccd6048..ef6c2e9 100644 (file)
@@ -32,23 +32,23 @@ import java.util.Properties;
 import java.util.Set;
 import java.util.Timer;
 import java.util.TimerTask;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 
 /**
  * This class provides utilities to read properties from a properties file, and optionally get
  * notifications of future changes.
  */
-public class PropertyUtil {
+public final class PropertyUtil {
 
+
+    @NoArgsConstructor(access = AccessLevel.PRIVATE)
     protected static class LazyHolder {
         /**
          * Timer thread.  Will not be allocated by the JVM until it is first referenced.
          * This may be overridden by junit tests.
          */
         private static Timer timer = new Timer("PropertyUtil-Timer", true);
-
-        private LazyHolder() {
-            super();
-        }
     }
 
     // this table maps canonical file into a 'ListenerRegistration' instance
index a059bd7..d16a1d7 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-Logging
  * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 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.
@@ -26,6 +26,7 @@ import com.att.eelf.configuration.EELFLogger.Level;
 import java.io.Serializable;
 import java.util.Arrays;
 import java.util.UUID;
+import lombok.Getter;
 import org.onap.policy.common.logging.OnapLoggingUtils;
 import org.onap.policy.common.logging.eelf.MessageCodes;
 import org.onap.policy.common.logging.eelf.PolicyLogger;
@@ -33,16 +34,17 @@ import org.onap.policy.common.logging.eelf.PolicyLogger;
 /**
  * SystemOutLogger implements all the methods of interface Logger by calling System.out.println
  */
+@Getter
 public class SystemOutLogger implements Logger, Serializable {
 
     private static final long serialVersionUID = 4956408061058933929L;
     private String className = "";
-    private boolean isDebugEnabled = true;
-    private boolean isInfoEnabled = true;
-    private boolean isWarnEnabled = true;
-    private boolean isErrorEnabled = true;
-    private boolean isAuditEnabled = true;
-    private boolean isMetricsEnabled = true;
+    private boolean debugEnabled = true;
+    private boolean infoEnabled = true;
+    private boolean warnEnabled = true;
+    private boolean errorEnabled = true;
+    private boolean auditEnabled = true;
+    private boolean metricsEnabled = true;
     private String transId = UUID.randomUUID().toString();
 
     /**
@@ -77,35 +79,35 @@ public class SystemOutLogger implements Logger, Serializable {
     private void initLevel() {
 
         if (PolicyLogger.getDebugLevel() == Level.DEBUG) {
-            isDebugEnabled = true;
-            isInfoEnabled = true;
-            isWarnEnabled = true;
+            debugEnabled = true;
+            infoEnabled = true;
+            warnEnabled = true;
         } else {
-            isDebugEnabled = false;
+            debugEnabled = false;
         }
 
         if (PolicyLogger.getDebugLevel() == Level.INFO) {
-            isInfoEnabled = true;
-            isWarnEnabled = true;
-            isDebugEnabled = false;
+            infoEnabled = true;
+            warnEnabled = true;
+            debugEnabled = false;
         }
 
         if (PolicyLogger.getDebugLevel() == Level.OFF) {
-            isInfoEnabled = false;
-            isWarnEnabled = false;
-            isDebugEnabled = false;
+            infoEnabled = false;
+            warnEnabled = false;
+            debugEnabled = false;
         }
 
         if (PolicyLogger.getErrorLevel() == Level.OFF) {
-            isErrorEnabled = false;
+            errorEnabled = false;
         }
 
         if (PolicyLogger.getAuditLevel() == Level.OFF) {
-            isAuditEnabled = false;
+            auditEnabled = false;
         }
 
         if (PolicyLogger.getMetricsLevel() == Level.OFF) {
-            isMetricsEnabled = false;
+            metricsEnabled = false;
         }
     }
 
@@ -119,15 +121,6 @@ public class SystemOutLogger implements Logger, Serializable {
         this.transId = transId;
     }
 
-    /**
-     * Returns transaction Id.
-     */
-    @Override
-    public String getTransId() {
-
-        return transId;
-    }
-
     /**
      * Records a message.
      *
@@ -344,68 +337,6 @@ public class SystemOutLogger implements Logger, Serializable {
         displayMessage(transId + "|" + className + " : " + message + ":" + throwable);
     }
 
-    /**
-     * Returns true for debug enabled, or false for not.
-     *
-     * @return boolean
-     */
-    @Override
-    public boolean isDebugEnabled() {
-        return isDebugEnabled;
-    }
-
-    /**
-     * Returns true for warn enabled, or false for not.
-     *
-     * @return boolean
-     */
-    @Override
-    public boolean isWarnEnabled() {
-        return isWarnEnabled;
-    }
-
-    /**
-     * Returns true for info enabled, or false for not.
-     *
-     * @return boolean
-     */
-    @Override
-    public boolean isInfoEnabled() {
-        return isInfoEnabled;
-    }
-
-    /**
-     * Returns true for error enabled, or false for not.
-     *
-     * @return boolean
-     */
-    @Override
-    public boolean isErrorEnabled() {
-        return isErrorEnabled;
-    }
-
-    /**
-     * Returns true for audit enabled, or false for not.
-     *
-     * @return boolean
-     */
-    @Override
-    public boolean isAuditEnabled() {
-
-        return isAuditEnabled;
-    }
-
-    /**
-     * Returns true for metrics enabled, or false for not.
-     *
-     * @return boolean
-     */
-    @Override
-    public boolean isMetricsEnabled() {
-
-        return isMetricsEnabled;
-    }
-
     /**
      * Records an audit message.
      *
index ee64306..eb2b318 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-Logging
  * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 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.
@@ -20,6 +20,8 @@
 
 package org.onap.policy.common.logging.nsa;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import org.onap.policy.common.logging.nsa.impl.SharedContext;
 import org.onap.policy.common.logging.nsa.impl.Slf4jLoggingContext;
 
@@ -27,6 +29,7 @@ import org.onap.policy.common.logging.nsa.impl.Slf4jLoggingContext;
  * A factory for setting up a LoggingContext.
  *
  */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class LoggingContextFactory {
     public static class Builder {
 
@@ -47,8 +50,4 @@ public class LoggingContextFactory {
             return forShared ? new SharedContext(baseContext) : new Slf4jLoggingContext(baseContext);
         }
     }
-
-    private LoggingContextFactory() {
-        // do nothing
-    }
 }
index 71a5db0..d4454db 100644 (file)
@@ -44,6 +44,8 @@ import javax.persistence.FlushModeType;
 import javax.persistence.LockModeType;
 import javax.persistence.Persistence;
 import javax.persistence.TypedQuery;
+import lombok.Getter;
+import lombok.Setter;
 import org.apache.commons.lang3.StringUtils;
 import org.eclipse.persistence.config.PersistenceUnitProperties;
 import org.onap.policy.common.im.jmx.ComponentAdmin;
@@ -104,6 +106,7 @@ public class IntegrityMonitor {
 
     public static final long CYCLE_INTERVAL_MILLIS = 1000L;
 
+    @Getter
     private StateManagement stateManager = null;
 
     /**
@@ -162,7 +165,9 @@ public class IntegrityMonitor {
     // For non-lead subsystems, the dependency_group property will be absent.
     private static String[] depGroups = null;
 
-    private static boolean isUnitTesting = false;
+    @Getter
+    @Setter
+    private static boolean unitTesting = false;
 
     // can turn on health checking of dependents via jmx test() call by setting
     // this property to true
@@ -198,7 +203,9 @@ public class IntegrityMonitor {
     private final Object refreshStateAuditLock = new Object();
     private final Object imFlushLock = new Object();
 
+    @Getter
     private Map<String, String> allSeemsWellMap;
+    @Getter
     private Map<String, String> allNotWellMap;
 
     /**
@@ -1254,11 +1261,6 @@ public class IntegrityMonitor {
         }
     }
 
-    // retrieve state manager reference
-    public final StateManagement getStateManager() {
-        return this.stateManager;
-    }
-
     /**
      * Read and validate properties.
      *
@@ -1894,14 +1896,6 @@ public class IntegrityMonitor {
         return (value < 0 ? -1 : value * 1000L);
     }
 
-    public Map<String, String> getAllSeemsWellMap() {
-        return allSeemsWellMap;
-    }
-
-    public Map<String, String> getAllNotWellMap() {
-        return allNotWellMap;
-    }
-
     // these methods may be overridden by junit tests
 
     /**
@@ -1930,16 +1924,4 @@ public class IntegrityMonitor {
     protected String getPersistenceUnit() {
         return PERSISTENCE_UNIT;
     }
-
-    /*
-     * The remaining methods are used by JUnit tests.
-     */
-
-    public static boolean isUnitTesting() {
-        return isUnitTesting;
-    }
-
-    public static void setUnitTesting(boolean isUnitTesting) {
-        IntegrityMonitor.isUnitTesting = isUnitTesting;
-    }
 }
index 252fd27..75aed5b 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * Integrity Monitor
  * ================================================================================
- * Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 2020-2021 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.
 
 package org.onap.policy.common.im;
 
-public class IntegrityMonitorProperties {
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class IntegrityMonitorProperties {
 
     public static final String DB_DRIVER = "javax.persistence.jdbc.driver";
     public static final String DB_URL = "javax.persistence.jdbc.url";
@@ -54,8 +58,4 @@ public class IntegrityMonitorProperties {
     // AllSeemsWell types
     public static final Boolean ALLNOTWELL = Boolean.FALSE;
     public static final Boolean ALLSEEMSWELL = Boolean.TRUE;
-
-    private IntegrityMonitorProperties() {
-        // Private constructor to prevent subclassing
-    }
 }
index e489a8c..61afb68 100644 (file)
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * Integrity Monitor
  * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018, 2021 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.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
 package org.onap.policy.common.im;
 
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
 import org.onap.policy.common.utils.time.CurrentTime;
 
 /**
  * "Current" time used by IntegrityMonitor classes.
  */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class MonitorTime {
 
     /**
      * Instance to be used. This is overridden by junit tests.
      */
+    @Getter
     private static CurrentTime instance = new CurrentTime();
-
-    /**
-     * Constructor.
-     */
-    private MonitorTime() {
-        super();
-    }
-
-    /**
-     * Get instance.
-     * 
-     * @return the CurrentTime singleton
-     */
-    public static CurrentTime getInstance() {
-        return instance;
-    }
 }
index eee3a9e..5fc111e 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * Integrity Monitor
  * ================================================================================
- * Copyright (C) 2017, 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2020-2021 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.
@@ -20,6 +20,7 @@
 
 package org.onap.policy.common.im;
 
+import lombok.Getter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 /*
@@ -43,6 +44,7 @@ import org.slf4j.LoggerFactory;
  * StateManagement class.
  *
  */
+@Getter
 public class StateChangeNotifier {
     private static final Logger logger = LoggerFactory.getLogger(StateChangeNotifier.class);
     // The observable class
@@ -71,12 +73,4 @@ public class StateChangeNotifier {
             logger.debug("handleStateChange, message: {}", this.message);
         }
     }
-
-    public StateManagement getStateManagement() {
-        return stateManagement;
-    }
-
-    public String getMessage() {
-        return message;
-    }
 }
index 73724b3..d1bc9cc 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * Integrity Monitor
  * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 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.
 package org.onap.policy.common.im;
 
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Getter
 @Setter
+@NoArgsConstructor
 public class StateElement {
     private static final Logger logger = LoggerFactory.getLogger(StateElement.class);
 
@@ -41,10 +43,6 @@ public class StateElement {
     String endingStandbyStatus = null;
     String exception = null;
 
-    public StateElement() {
-        // Empty constructor
-    }
-
     /**
      * Display the state element.
      */
index 2f9544e..ad1ef36 100644 (file)
@@ -33,6 +33,10 @@ import javax.persistence.PreUpdate;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
 /*
  * The Entity class to persist a policy object ForwardProgress
  */
@@ -43,7 +47,9 @@ import org.onap.policy.common.im.MonitorTime;
 @NamedQuery(name = " ForwardProgressEntity.findAll", query = "SELECT e FROM ForwardProgressEntity e ")
 @NamedQuery(name = "ForwardProgressEntity.deleteAll", query = "DELETE FROM ForwardProgressEntity WHERE 1=1")
 // @SequenceGenerator(name="seqForwardProgress", initialValue=1, allocationSize=1)
-
+@Getter
+@Setter
+@NoArgsConstructor
 public class ForwardProgressEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -51,6 +57,7 @@ public class ForwardProgressEntity implements Serializable {
     // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqForwardProgress")
     @GeneratedValue(strategy = GenerationType.AUTO)
     @Column(name = "forwardProgressId")
+    @Setter(AccessLevel.NONE)
     private long forwardProgressId;
 
     @Column(name = "resourceName", nullable = false, length = 100, unique = true)
@@ -67,10 +74,6 @@ public class ForwardProgressEntity implements Serializable {
     @Column(name = "last_updated")
     private Date lastUpdated;
 
-    public ForwardProgressEntity() {
-        // default constructor
-    }
-
     /**
      * PrePersist callback method.
      */
@@ -86,57 +89,4 @@ public class ForwardProgressEntity implements Serializable {
     public void preUpdate() {
         this.lastUpdated = MonitorTime.getInstance().getDate();
     }
-
-    /**
-     * Get the forward progress Id.
-     *
-     * @return the Id
-     */
-    public long getForwardProgressId() {
-        return forwardProgressId;
-    }
-
-    public String getResourceName() {
-        return this.resourceName;
-    }
-
-    public void setResourceName(String resourceName) {
-        this.resourceName = resourceName;
-    }
-
-    /**
-     * Get the fpcCount.
-     *
-     * @return the fpcCount
-     */
-    public long getFpcCount() {
-        return fpcCount;
-    }
-
-    /**
-     * Set the fpcCount.
-     *
-     * @param fpcCount the fpcCount to set
-     */
-    public void setFpcCount(long fpcCount) {
-        this.fpcCount = fpcCount;
-    }
-
-    /**
-     * Get the lastUpdated.
-     *
-     * @return the lastUpdated
-     */
-    public Date getLastUpdated() {
-        return lastUpdated;
-    }
-
-    /**
-     * Set the lastUpdated.
-     *
-     * @param lastUpdated the lastUpdated to set
-     */
-    public void setLastUpdated(Date lastUpdated) {
-        this.lastUpdated = lastUpdated;
-    }
 }
index 858a3f7..2b7b3d7 100644 (file)
@@ -33,6 +33,10 @@ import javax.persistence.PreUpdate;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
 import org.onap.policy.common.im.MonitorTime;
 
 @Entity
@@ -40,7 +44,9 @@ import org.onap.policy.common.im.MonitorTime;
 @NamedQuery(name = " ImTestEntity.findAll", query = "SELECT e FROM ImTestEntity e ")
 @NamedQuery(name = "ImTestEntity.deleteAll", query = "DELETE FROM ImTestEntity WHERE 1=1")
 // @SequenceGenerator(name="seqImTest", initialValue=1, allocationSize=1)
-
+@Getter
+@Setter
+@NoArgsConstructor
 public class ImTestEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -48,6 +54,7 @@ public class ImTestEntity implements Serializable {
     // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqImTest")
     @GeneratedValue(strategy = GenerationType.AUTO)
     @Column(name = "ImTestId")
+    @Setter(AccessLevel.NONE)
     private long imTestId;
 
     @Column(name = "created_by", nullable = false, length = 255)
@@ -64,10 +71,6 @@ public class ImTestEntity implements Serializable {
     @Column(name = "modified_date", nullable = false)
     private Date modifiedDate;
 
-    public ImTestEntity() {
-        // default constructor
-    }
-
     /**
      * PrePersist callback method.
      */
@@ -82,76 +85,4 @@ public class ImTestEntity implements Serializable {
     public void preUpdate() {
         this.modifiedDate = MonitorTime.getInstance().getDate();
     }
-
-    /**
-     * Get the Im test Id.
-     *
-     * @return the Id
-     */
-    public long getImTestId() {
-        return imTestId;
-    }
-
-    /**
-     * Get the createdBy.
-     *
-     * @return the createdBy
-     */
-    public String getCreatedBy() {
-        return createdBy;
-    }
-
-    /**
-     * Set the createdBy.
-     *
-     * @param createdBy the createdBy to set
-     */
-    public void setCreatedBy(String createdBy) {
-        this.createdBy = createdBy;
-    }
-
-    /**
-     * Get the modifiedBy.
-     *
-     * @return the modifiedBy
-     */
-    public String getModifiedBy() {
-        return modifiedBy;
-    }
-
-    /**
-     * Set the ModifiedBy.
-     *
-     * @param modifiedBy the modifiedBy to set
-     */
-    public void setModifiedBy(String modifiedBy) {
-        this.modifiedBy = modifiedBy;
-    }
-
-    /**
-     * Get the modifiedDate.
-     *
-     * @return the modifiedDate
-     */
-    public Date getModifiedDate() {
-        return modifiedDate;
-    }
-
-    /**
-     * Set the modifiedDate.
-     *
-     * @param modifiedDate the modifiedDate to set
-     */
-    public void setModifiedDate(Date modifiedDate) {
-        this.modifiedDate = modifiedDate;
-    }
-
-    /**
-     * Get the createdDate.
-     *
-     * @return the createdDate
-     */
-    public Date getCreatedDate() {
-        return createdDate;
-    }
 }
index 0e654d3..1754c40 100644 (file)
@@ -33,6 +33,10 @@ import javax.persistence.PreUpdate;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
 import org.onap.policy.common.im.MonitorTime;
 /*
  * The Entity class to persist a policy object ResourceRegistration
@@ -43,7 +47,9 @@ import org.onap.policy.common.im.MonitorTime;
 @NamedQuery(name = " ResourceRegistrationEntity.findAll", query = "SELECT e FROM ResourceRegistrationEntity e ")
 @NamedQuery(name = "ResourceRegistrationEntity.deleteAll", query = "DELETE FROM ResourceRegistrationEntity WHERE 1=1")
 // @SequenceGenerator(name="seqResourceRegistration", initialValue=1, allocationSize=1)
-
+@Getter
+@Setter
+@NoArgsConstructor
 public class ResourceRegistrationEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -51,6 +57,7 @@ public class ResourceRegistrationEntity implements Serializable {
     // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqResourceRegistration")
     @GeneratedValue(strategy = GenerationType.AUTO)
     @Column(name = "ResourceRegistrationId")
+    @Setter(AccessLevel.NONE)
     private long resourceRegistrationId;
 
     @Column(name = "resourceName", nullable = false, length = 100, unique = true)
@@ -73,10 +80,6 @@ public class ResourceRegistrationEntity implements Serializable {
     @Column(name = "last_updated")
     private Date lastUpdated;
 
-    public ResourceRegistrationEntity() {
-        // default constructor
-    }
-
     /**
      * PrePersist callback method.
      */
@@ -91,72 +94,4 @@ public class ResourceRegistrationEntity implements Serializable {
     public void preUpdate() {
         this.lastUpdated = MonitorTime.getInstance().getDate();
     }
-
-    /**
-     * Get the resource registration Id.
-     *
-     * @return the Id
-     */
-    public long getResourceRegistrationId() {
-        return resourceRegistrationId;
-    }
-
-    public String getResourceName() {
-        return this.resourceName;
-    }
-
-    public void setResourceName(String resourceName) {
-        this.resourceName = resourceName;
-    }
-
-    public String getResourceUrl() {
-        return this.resourceUrl;
-    }
-
-    public void setResourceUrl(String resourceUrl) {
-        this.resourceUrl = resourceUrl;
-    }
-
-    public String getSite() {
-        return this.site;
-    }
-
-    public void setSite(String site) {
-        this.site = site;
-    }
-
-    public String getNodeType() {
-        return this.nodeType;
-    }
-
-    public void setNodeType(String nodeType) {
-        this.nodeType = nodeType;
-    }
-
-    /**
-     * Get the createdDate.
-     *
-     * @return the createdDate
-     */
-    public Date getCreatedDate() {
-        return createdDate;
-    }
-
-    /**
-     * Get the lastUpdated.
-     *
-     * @return the lastUpdated
-     */
-    public Date getLastUpdated() {
-        return lastUpdated;
-    }
-
-    /**
-     * Set the lastUpdated.
-     *
-     * @param lastUpdated the lastUpdated to set
-     */
-    public void setLastUpdated(Date lastUpdated) {
-        this.lastUpdated = lastUpdated;
-    }
 }
index b13d3a7..c04a1b3 100644 (file)
@@ -35,6 +35,7 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import lombok.AccessLevel;
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.onap.policy.common.im.MonitorTime;
 
@@ -45,7 +46,7 @@ import org.onap.policy.common.im.MonitorTime;
 
 @Getter
 @Setter
-
+@NoArgsConstructor
 public class StateManagementEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -81,10 +82,6 @@ public class StateManagementEntity implements Serializable {
     @Column(name = "modifiedDate", nullable = false)
     private Date modifiedDate;
 
-    public StateManagementEntity() {
-        // default constructor
-    }
-
     @PrePersist
     public void prePersist() {
         this.createdDate = MonitorTime.getInstance().getDate();