diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2023-07-21 09:41:01 +0100 |
---|---|---|
committer | adheli.tavares <adheli.tavares@est.tech> | 2023-09-21 14:29:31 +0100 |
commit | 349b4ae7179173f9261d9a432094cb55dc433820 (patch) | |
tree | 4c13de684e11e7945ae52e178fd7d685601fff01 /integrity-monitor/src/main | |
parent | b902de16baecd36652db1208093030cedde813bb (diff) |
Java 17 Upgrade
Issue-ID: POLICY-4668
Change-Id: If4e79224de61d66d7514f3abbd7b8bee1c3d5681
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'integrity-monitor/src/main')
8 files changed, 80 insertions, 74 deletions
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java index d0b320fc..e7cb4ab4 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java @@ -22,6 +22,13 @@ package org.onap.policy.common.im; import com.google.re2j.Pattern; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.EntityTransaction; +import jakarta.persistence.FlushModeType; +import jakarta.persistence.LockModeType; +import jakarta.persistence.Persistence; +import jakarta.persistence.TypedQuery; import java.net.InetAddress; import java.util.ArrayList; import java.util.Arrays; @@ -38,13 +45,6 @@ import java.util.function.LongConsumer; import java.util.function.Supplier; import javax.management.JMX; import javax.management.MBeanServerConnection; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.EntityTransaction; -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; diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java index 75aed5b3..6af7a557 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java @@ -3,6 +3,7 @@ * Integrity Monitor * ================================================================================ * Copyright (C) 2017-2018, 2020-2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,10 +27,10 @@ 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"; - public static final String DB_USER = "javax.persistence.jdbc.user"; - public static final String DB_PWD = "javax.persistence.jdbc.password"; //NOSONAR + public static final String DB_DRIVER = "jakarta.persistence.jdbc.driver"; + public static final String DB_URL = "jakarta.persistence.jdbc.url"; + public static final String DB_USER = "jakarta.persistence.jdbc.user"; + public static final String DB_PWD = "jakarta.persistence.jdbc.password"; //NOSONAR // intervals specified are in seconds public static final int DEFAULT_MONITOR_INTERVAL = 30; diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java index b68373ba..eace6037 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java @@ -3,6 +3,7 @@ * Integrity Monitor * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,16 +21,16 @@ package org.onap.policy.common.im; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.FlushModeType; +import jakarta.persistence.LockModeType; +import jakarta.persistence.TypedQuery; import java.util.Collection; import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.FlushModeType; -import javax.persistence.LockModeType; -import javax.persistence.TypedQuery; import org.onap.policy.common.im.exceptions.EntityRetrievalException; import org.onap.policy.common.im.jpa.StateManagementEntity; import org.onap.policy.common.utils.jpa.EntityMgrCloser; @@ -377,7 +378,7 @@ public class StateManagement { notFound.run(); } } catch (final Exception ex) { - logger.error("StateManagement: {} exception: {}", methodName, ex.toString(), ex); + logger.error("StateManagement: {} exception: {}", methodName, ex.getMessage(), ex); } } diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/DateEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/DateEntity.java index 769aa9d9..5213baef 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/DateEntity.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/DateEntity.java @@ -3,6 +3,7 @@ * Integrity Monitor * ================================================================================ * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,14 +21,15 @@ package org.onap.policy.common.im.jpa; +import jakarta.persistence.Column; +import jakarta.persistence.MappedSuperclass; +import jakarta.persistence.PrePersist; +import jakarta.persistence.PreUpdate; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; +import java.io.Serial; import java.io.Serializable; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.MappedSuperclass; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -41,6 +43,7 @@ import org.onap.policy.common.im.MonitorTime; @Setter @NoArgsConstructor public class DateEntity implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Temporal(TemporalType.TIMESTAMP) diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java index f4c3f4f0..7c9698b3 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java @@ -21,15 +21,15 @@ package org.onap.policy.common.im.jpa; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.PrePersist; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.PrePersist; +import jakarta.persistence.Table; +import java.io.Serial; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; @@ -37,14 +37,13 @@ import lombok.Setter; @Entity @Table(name = "ForwardProgressEntity") -@NamedQueries({ - @NamedQuery(name = " ForwardProgressEntity.findAll", query = "SELECT e FROM ForwardProgressEntity e "), - @NamedQuery(name = "ForwardProgressEntity.deleteAll", query = "DELETE FROM ForwardProgressEntity WHERE 1=1") -}) +@NamedQuery(name = " ForwardProgressEntity.findAll", query = "SELECT e FROM ForwardProgressEntity e ") +@NamedQuery(name = "ForwardProgressEntity.deleteAll", query = "DELETE FROM ForwardProgressEntity WHERE 1=1") @Getter @Setter @NoArgsConstructor public class ForwardProgressEntity extends DateEntity { + @Serial private static final long serialVersionUID = 1L; @Id diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java index 96a23908..420bdcf3 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java @@ -21,20 +21,21 @@ package org.onap.policy.common.im.jpa; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.NamedQueries; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.PrePersist; +import jakarta.persistence.PreUpdate; +import jakarta.persistence.Table; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; +import java.io.Serial; import java.io.Serializable; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.PrePersist; -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; @@ -52,6 +53,7 @@ import org.onap.policy.common.im.MonitorTime; @Setter @NoArgsConstructor public class ImTestEntity implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Id diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java index 7457f733..a771ba09 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java @@ -21,14 +21,15 @@ package org.onap.policy.common.im.jpa; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.NamedQueries; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.Table; +import java.io.Serial; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; @@ -39,16 +40,13 @@ import lombok.Setter; @Entity @Table(name = "ResourceRegistrationEntity") -@NamedQueries({ - @NamedQuery(name = " ResourceRegistrationEntity.findAll", query = "SELECT e FROM ResourceRegistrationEntity e "), - @NamedQuery( - name = "ResourceRegistrationEntity.deleteAll", - query = "DELETE FROM ResourceRegistrationEntity WHERE 1=1") -}) +@NamedQuery(name = " ResourceRegistrationEntity.findAll", query = "SELECT e FROM ResourceRegistrationEntity e ") +@NamedQuery(name = "ResourceRegistrationEntity.deleteAll", query = "DELETE FROM ResourceRegistrationEntity WHERE 1=1") @Getter @Setter @NoArgsConstructor public class ResourceRegistrationEntity extends DateEntity { + @Serial private static final long serialVersionUID = 1L; @Id diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java index 44c4e9b7..b03ec71b 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java @@ -3,6 +3,7 @@ * Integrity Monitor * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,19 +21,20 @@ package org.onap.policy.common.im.jpa; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.PrePersist; +import jakarta.persistence.PreUpdate; +import jakarta.persistence.Table; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; +import java.io.Serial; import java.io.Serializable; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQuery; -import javax.persistence.PrePersist; -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; @@ -42,11 +44,11 @@ import org.onap.policy.common.im.MonitorTime; @Entity @Table(name = "StateManagementEntity") @NamedQuery(name = "StateManagementEntity.findAll", query = "SELECT e FROM StateManagementEntity e") - @Getter @Setter @NoArgsConstructor public class StateManagementEntity implements Serializable { + @Serial private static final long serialVersionUID = 1L; @Id |