diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2023-07-27 10:12:59 +0100 |
---|---|---|
committer | adheli.tavares <adheli.tavares@est.tech> | 2023-09-22 12:58:53 +0100 |
commit | 938005505883cf7a636a8840e20e3dc8a0ad9176 (patch) | |
tree | f2820c1f44c458e95e565943b04b697cb5c88c12 /models-pdp/src/main/java | |
parent | d19537308cbdce440c1faf819eb586983d0a67c9 (diff) |
Java 17 Upgrade
Issue-ID: POLICY-4669
Change-Id: I0157ae0ea7151658308c7e6d429098f16824c190
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'models-pdp/src/main/java')
6 files changed, 64 insertions, 70 deletions
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<Pdp>, 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<PdpGroup> { + @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<PdpPolicyStatus> { + @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<PdpSubGroup> { + @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<PdpGroup> getPdpGroups(@NonNull final PfDao dao, final String name) throws PfModelException { + public List<PdpGroup> 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<PdpGroup> 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<PdpGroup> createPdpGroups(@NonNull final PfDao dao, @NonNull final List<PdpGroup> pdpGroups) - throws PfModelException { + public List<PdpGroup> createPdpGroups(@NonNull final PfDao dao, @NonNull final List<PdpGroup> 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<PdpGroup> updatePdpGroups(@NonNull final PfDao dao, @NonNull final List<PdpGroup> pdpGroups) - throws PfModelException { + public List<PdpGroup> updatePdpGroups(@NonNull final PfDao dao, @NonNull final List<PdpGroup> 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<PdpPolicyStatus> getAllPolicyStatus(@NonNull final PfDao dao) - throws PfModelException { - + public List<PdpPolicyStatus> 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<PdpPolicyStatus> 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<PdpPolicyStatus> getGroupPolicyStatus(@NonNull final PfDao dao, @NonNull final String groupName) - throws PfModelException { - + public List<PdpPolicyStatus> 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) |