diff options
Diffstat (limited to 'integrity-audit/src/main')
5 files changed, 33 insertions, 32 deletions
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbAudit.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbAudit.java index d20ed80c..7dd66542 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbAudit.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbAudit.java @@ -3,6 +3,7 @@ * Integrity Audit * ================================================================================ * 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,6 +21,7 @@ package org.onap.policy.common.ia; +import jakarta.persistence.Table; import java.io.Serializable; import java.util.Arrays; import java.util.HashMap; @@ -29,7 +31,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Properties; import java.util.Set; -import javax.persistence.Table; import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.builder.RecursiveToStringStyle; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; @@ -459,13 +460,13 @@ public class DbAudit { String tableName = entityClass.getAnnotation(Table.class).name(); String msg = "\nDB Audit Error: " + "\n Table Name: " + tableName + "\n Entry 1 (short prefix style): " + resourceName1 + ": " - + new ReflectionToStringBuilder(entry1, ToStringStyle.SHORT_PREFIX_STYLE).toString() + + new ReflectionToStringBuilder(entry1, ToStringStyle.SHORT_PREFIX_STYLE) + "\n Entry 2 (short prefix style): " + resourceName2 + ": " + (entry2 != null ? new ReflectionToStringBuilder(entry2, ToStringStyle.SHORT_PREFIX_STYLE).toString() : "null") + "\n Entry 1 (recursive style): " + resourceName1 + ": " - + new ReflectionToStringBuilder(entry1, new RecursiveToStringStyle()).toString() + + new ReflectionToStringBuilder(entry1, new RecursiveToStringStyle()) + "\n Entry 2 (recursive style): " + resourceName2 + ": " + (entry2 != null ? new ReflectionToStringBuilder(entry2, new RecursiveToStringStyle()).toString() diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java index e83bbca8..de383868 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java @@ -3,6 +3,7 @@ * Integrity Audit * ================================================================================ * 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,6 +21,15 @@ package org.onap.policy.common.ia; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.EntityTransaction; +import jakarta.persistence.Persistence; +import jakarta.persistence.Query; +import jakarta.persistence.TypedQuery; +import jakarta.persistence.criteria.CriteriaQuery; +import jakarta.persistence.criteria.Root; +import jakarta.persistence.metamodel.ManagedType; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -27,15 +37,6 @@ import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.function.BiConsumer; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.EntityTransaction; -import javax.persistence.Persistence; -import javax.persistence.Query; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Root; -import javax.persistence.metamodel.ManagedType; import org.onap.policy.common.ia.jpa.IntegrityAuditEntity; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java index 9122b721..cd80f56f 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java @@ -3,6 +3,7 @@ * Integrity Audit * ================================================================================ * 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. @@ -28,10 +29,10 @@ public class IntegrityAuditProperties { public static final int DEFAULT_AUDIT_PERIOD_SECONDS = -1; // Audit does not run - 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 public static final String AUDIT_PERIOD_SECONDS = "integrity_audit_period_seconds"; diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java index 07b85579..ec9c2a4d 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java @@ -21,29 +21,26 @@ package org.onap.policy.common.ia.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.IOException; import java.io.ObjectOutputStream; 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; import lombok.Setter; -/* - * The Entity class to for management of IntegrityAudits - */ import org.onap.policy.common.ia.AuditorTime; @Entity diff --git a/integrity-audit/src/main/resources/META-INF/persistence.xml b/integrity-audit/src/main/resources/META-INF/persistence.xml index b648cd63..3a7fdd7f 100644 --- a/integrity-audit/src/main/resources/META-INF/persistence.xml +++ b/integrity-audit/src/main/resources/META-INF/persistence.xml @@ -25,11 +25,12 @@ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> <persistence-unit name="testPU" transaction-type="RESOURCE_LOCAL"> <!-- Limited use for generating the DB and schema files for iatest DB - uses hibernate --> + <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class> <class>org.onap.policy.common.ia.jpa.IaTestEntity</class> <shared-cache-mode>NONE</shared-cache-mode> <properties> - <property name="javax.persistence.schema-generation.database.action" value="create" /> + <property name="jakarta.persistence.schema-generation.database.action" value="create" /> <property name="hibernate.show_sql" value="false" /> </properties> </persistence-unit> |