From 938005505883cf7a636a8840e20e3dc8a0ad9176 Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Thu, 27 Jul 2023 10:12:59 +0100 Subject: Java 17 Upgrade Issue-ID: POLICY-4669 Change-Id: I0157ae0ea7151658308c7e6d429098f16824c190 Signed-off-by: adheli.tavares --- models-pdp/pom.xml | 2 +- .../pdp/concepts/PdpEngineWorkerStatistics.java | 6 ++-- .../models/pdp/persistence/concepts/JpaPdp.java | 20 +++++++------ .../pdp/persistence/concepts/JpaPdpGroup.java | 28 +++++++++-------- .../persistence/concepts/JpaPdpPolicyStatus.java | 17 ++++++----- .../pdp/persistence/concepts/JpaPdpSubGroup.java | 28 +++++++++-------- .../pdp/persistence/provider/PdpProvider.java | 35 ++++++---------------- 7 files changed, 65 insertions(+), 71 deletions(-) (limited to 'models-pdp') diff --git a/models-pdp/pom.xml b/models-pdp/pom.xml index 92b07be1f..cacbbc992 100644 --- a/models-pdp/pom.xml +++ b/models-pdp/pom.xml @@ -25,7 +25,7 @@ org.onap.policy.models policy-models - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT policy-models-pdp diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatistics.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatistics.java index 06f603069..402ef15aa 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatistics.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpEngineWorkerStatistics.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * Copyright (C) 2019-2020, 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,8 +20,9 @@ package org.onap.policy.models.pdp.concepts; +import jakarta.persistence.Embeddable; +import java.io.Serial; import java.io.Serializable; -import javax.persistence.Embeddable; import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; @@ -31,6 +32,7 @@ import org.onap.policy.models.pdp.enums.PdpEngineWorkerState; @Data @NoArgsConstructor public class PdpEngineWorkerStatistics implements Serializable { + @Serial private static final long serialVersionUID = 8262176849743624013L; private String engineId; diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java index 7c584f3e6..fd594a99f 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java @@ -3,7 +3,7 @@ * ONAP Policy Model * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019, 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. @@ -23,17 +23,18 @@ package org.onap.policy.models.pdp.persistence.concepts; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +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 java.util.List; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -61,6 +62,7 @@ import org.onap.policy.models.pdp.enums.PdpState; @Data @EqualsAndHashCode(callSuper = false) public class JpaPdp extends PfConcept implements PfAuthorative, Serializable { + @Serial private static final long serialVersionUID = -357224425637789775L; @EmbeddedId diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java index 07f9261bb..52f145659 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java @@ -3,7 +3,7 @@ * ONAP Policy Model * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019,2021 Nordix Foundation. + * Modifications Copyright (C) 2019, 2021, 2023 Nordix Foundation. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,23 +24,24 @@ package org.onap.policy.models.pdp.persistence.concepts; +import jakarta.persistence.CascadeType; +import jakarta.persistence.CollectionTable; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import javax.persistence.CascadeType; -import javax.persistence.CollectionTable; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -70,6 +71,7 @@ import org.onap.policy.models.pdp.enums.PdpState; @Data @EqualsAndHashCode(callSuper = false) public class JpaPdpGroup extends PfConcept implements PfAuthorative { + @Serial private static final long serialVersionUID = -357224425637789775L; @EmbeddedId diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java index 88fb14a90..857e38a12 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * 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.models.pdp.persistence.concepts; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.Index; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.List; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Index; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -57,6 +59,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @Data @EqualsAndHashCode(callSuper = false) public class JpaPdpPolicyStatus extends PfConcept implements PfAuthorative { + @Serial private static final long serialVersionUID = -357224425637789775L; /** diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java index 1d49a9b8b..0d963c853 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java @@ -3,7 +3,7 @@ * ONAP Policy Model * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019-2021 Nordix Foundation. + * Modifications Copyright (C) 2019-2021, 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. @@ -23,23 +23,24 @@ package org.onap.policy.models.pdp.persistence.concepts; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinTable; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; +import java.io.Serial; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.OneToMany; -import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; @@ -72,6 +73,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @Data @EqualsAndHashCode(callSuper = false) public class JpaPdpSubGroup extends PfConcept implements PfAuthorative { + @Serial private static final long serialVersionUID = -357224425637789775L; @EmbeddedId diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java index 0cc0eb267..fe4632893 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2023 Nordix Foundation. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2023 Bell Canada. All rights reserved. * ================================================================================ @@ -22,13 +22,13 @@ package org.onap.policy.models.pdp.persistence.provider; +import jakarta.ws.rs.core.Response; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import javax.ws.rs.core.Response; import lombok.NonNull; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.models.base.PfConceptKey; @@ -63,9 +63,8 @@ public class PdpProvider { * @param dao the DAO to use to access the database * @param name the name of the PDP group to get, null to get all PDP groups * @return the PDP groups found - * @throws PfModelException on errors getting PDP groups */ - public List getPdpGroups(@NonNull final PfDao dao, final String name) throws PfModelException { + public List getPdpGroups(@NonNull final PfDao dao, final String name) { return asPdpGroupList(dao.getFiltered(JpaPdpGroup.class, name, PfKey.NULL_KEY_VERSION)); } @@ -76,7 +75,6 @@ public class PdpProvider { * @param dao the DAO to use to access the database * @param filter the filter for the PDP groups to get * @return the PDP groups found - * @throws PfModelException on errors getting policies */ public List getFilteredPdpGroups(@NonNull final PfDao dao, @NonNull final PdpGroupFilter filter) { @@ -90,10 +88,8 @@ public class PdpProvider { * @param dao the DAO to use to access the database * @param pdpGroups a specification of the PDP groups to create * @return the PDP groups created - * @throws PfModelException on errors creating PDP groups */ - public List createPdpGroups(@NonNull final PfDao dao, @NonNull final List pdpGroups) - throws PfModelException { + public List createPdpGroups(@NonNull final PfDao dao, @NonNull final List pdpGroups) { for (PdpGroup pdpGroup : pdpGroups) { var jpaPdpGroup = new JpaPdpGroup(); @@ -124,10 +120,8 @@ public class PdpProvider { * @param dao the DAO to use to access the database * @param pdpGroups a specification of the PDP groups to update * @return the PDP groups updated - * @throws PfModelException on errors updating PDP groups */ - public List updatePdpGroups(@NonNull final PfDao dao, @NonNull final List pdpGroups) - throws PfModelException { + public List updatePdpGroups(@NonNull final PfDao dao, @NonNull final List pdpGroups) { for (PdpGroup pdpGroup : pdpGroups) { var jpaPdpGroup = new JpaPdpGroup(); @@ -159,10 +153,9 @@ public class PdpProvider { * @param dao the DAO to use to access the database * @param pdpGroupName the name of the PDP group of the PDP subgroup * @param pdpSubGroup the PDP subgroup to be updated - * @throws PfModelException on errors updating PDP subgroups */ public void updatePdpSubGroup(@NonNull final PfDao dao, @NonNull final String pdpGroupName, - @NonNull final PdpSubGroup pdpSubGroup) throws PfModelException { + @NonNull final PdpSubGroup pdpSubGroup) { final var subGroupKey = new PfReferenceKey(pdpGroupName, PfKey.NULL_KEY_VERSION, pdpSubGroup.getPdpType()); @@ -184,7 +177,6 @@ public class PdpProvider { * @param pdpGroupName the name of the PDP group of the PDP subgroup * @param pdpSubGroup the PDP subgroup to be updated * @param pdp the PDP to be updated - * @throws PfModelException on errors updating PDP subgroups */ public void updatePdp(@NonNull final PfDao dao, @NonNull final String pdpGroupName, @NonNull final String pdpSubGroup, @NonNull final Pdp pdp) { @@ -208,7 +200,6 @@ public class PdpProvider { * @param dao the DAO to use to access the database * @param name the name of the policy to get, null to get all PDP groups * @return the PDP group deleted - * @throws PfModelException on errors deleting PDP groups */ public PdpGroup deletePdpGroup(@NonNull final PfDao dao, @NonNull final String name) { @@ -232,11 +223,8 @@ public class PdpProvider { * * @param dao the DAO to use to access the database * @return the deployments found - * @throws PfModelException on errors getting PDP groups */ - public List getAllPolicyStatus(@NonNull final PfDao dao) - throws PfModelException { - + public List getAllPolicyStatus(@NonNull final PfDao dao) { return dao.getAll(JpaPdpPolicyStatus.class).stream().map(JpaPdpPolicyStatus::toAuthorative) .collect(Collectors.toList()); } @@ -246,11 +234,9 @@ public class PdpProvider { * * @param dao the DAO to use to access the database * @return the deployments found - * @throws PfModelException on errors getting PDP groups */ public List getAllPolicyStatus(@NonNull final PfDao dao, - @NonNull ToscaConceptIdentifierOptVersion policy) throws PfModelException { - + @NonNull ToscaConceptIdentifierOptVersion policy) { if (policy.getVersion() != null) { return dao.getAll(JpaPdpPolicyStatus.class, new PfConceptKey(policy.getName(), policy.getVersion())) .stream().map(JpaPdpPolicyStatus::toAuthorative).collect(Collectors.toList()); @@ -268,11 +254,8 @@ public class PdpProvider { * @param groupName the name of the PDP group of interest, null to get results for all * PDP groups * @return the deployments found - * @throws PfModelException on errors getting PDP groups */ - public List getGroupPolicyStatus(@NonNull final PfDao dao, @NonNull final String groupName) - throws PfModelException { - + public List getGroupPolicyStatus(@NonNull final PfDao dao, @NonNull final String groupName) { PfFilterParameters params = PfFilterParameters.builder().filterMap(Map.of("pdpGroup", groupName)).build(); return dao.getFiltered(JpaPdpPolicyStatus.class, params) -- cgit 1.2.3-korg