summaryrefslogtreecommitdiffstats
path: root/models-pdp/src/main/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'models-pdp/src/main/java/org/onap')
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java9
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java19
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java8
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java17
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java13
5 files changed, 32 insertions, 34 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
index 1a1fe228d..35443a291 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +28,7 @@ import lombok.NonNull;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* A deployment (i.e., set of policies) for all PDPs of the same pdp type running within a
@@ -44,7 +45,7 @@ public class DeploymentSubGroup {
private String pdpType;
private Action action;
- private List<ToscaPolicyIdentifier> policies;
+ private List<ToscaConceptIdentifier> policies;
/**
* Constructs the object.
@@ -61,7 +62,7 @@ public class DeploymentSubGroup {
public DeploymentSubGroup(@NonNull final DeploymentSubGroup source) {
this.pdpType = source.pdpType;
this.action = source.action;
- this.policies = PfUtils.mapList(source.policies, ToscaPolicyIdentifier::new, new ArrayList<>(0));
+ this.policies = PfUtils.mapList(source.policies, ToscaConceptIdentifier::new, new ArrayList<>(0));
}
/**
@@ -75,7 +76,7 @@ public class DeploymentSubGroup {
result.validateNotNull("pdpType", pdpType);
result.validateNotNull("action", action);
- result.validateNotNullList("policies", policies, ToscaPolicyIdentifier::validatePapRest);
+ result.validateNotNullList("policies", policies, ToscaConceptIdentifier::validatePapRest);
return result;
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java
index 313482d2e..a7ceaa9a5 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,8 +29,7 @@ import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
import org.onap.policy.models.base.PfObjectFilter;
import org.onap.policy.models.pdp.enums.PdpState;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Filter class for searches for {@link PdpGroup} instances. If any fields are null, they are ignored.
@@ -50,14 +49,14 @@ public class PdpGroupFilter implements PfObjectFilter<PdpGroup> {
private String pdpType;
// Set regular expressions on fields to match policy type names and versions
- private List<ToscaPolicyTypeIdentifier> policyTypeList;
+ private List<ToscaConceptIdentifier> policyTypeList;
// If set, only PDP groups where policy types are matched exactly are returned
@Builder.Default
private boolean matchPolicyTypesExactly = false;
// Set regular expressions on fields to match policy names and versions
- private List<ToscaPolicyIdentifier> policyList;
+ private List<ToscaConceptIdentifier> policyList;
// If set, only PDP groups where policies are matched exactly are returned
@Builder.Default
@@ -110,7 +109,7 @@ public class PdpGroupFilter implements PfObjectFilter<PdpGroup> {
* @param matchPolicyTypesExactly if true, only PDP groups where policy types are matched exactly are returned
* @return true if the filter should let this PDP group through
*/
- private boolean filterOnPolicyTypeList(final PdpGroup pdpGroup, final List<ToscaPolicyTypeIdentifier> typeFilter,
+ private boolean filterOnPolicyTypeList(final PdpGroup pdpGroup, final List<ToscaConceptIdentifier> typeFilter,
final boolean matchPolicyTypesExactly) {
if (typeFilter == null) {
return true;
@@ -139,9 +138,9 @@ public class PdpGroupFilter implements PfObjectFilter<PdpGroup> {
* @return true if one element of the elements to find is supported by an element on
* the list we searched
*/
- private boolean findSupportedPolicyType(List<ToscaPolicyTypeIdentifier> supportedPolicyTypes,
- List<ToscaPolicyTypeIdentifier> typeFilter) {
- for (ToscaPolicyTypeIdentifier supportedPolicyType : supportedPolicyTypes) {
+ private boolean findSupportedPolicyType(List<ToscaConceptIdentifier> supportedPolicyTypes,
+ List<ToscaConceptIdentifier> typeFilter) {
+ for (ToscaConceptIdentifier supportedPolicyType : supportedPolicyTypes) {
String supName = supportedPolicyType.getName();
if (supName.endsWith(".*")) {
String substr = supName.substring(0, supName.length() - 1);
@@ -164,7 +163,7 @@ public class PdpGroupFilter implements PfObjectFilter<PdpGroup> {
* @param matchPoliciesExactly if true, only PDP groups where ps are matched exactly are returned
* @return true if the filter should let this PDP group through
*/
- private boolean filterOnPolicyList(final PdpGroup pdpGroup, final List<ToscaPolicyIdentifier> policyFilter,
+ private boolean filterOnPolicyList(final PdpGroup pdpGroup, final List<ToscaConceptIdentifier> policyFilter,
final boolean matchPoliciesExactly) {
if (policyFilter == null) {
return true;
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
index 6207bbe0c..e90a4d10e 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,7 +30,7 @@ import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpMessageType;
import org.onap.policy.models.pdp.enums.PdpState;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Class to represent the PDP_STATUS message that all the PDP's will send to PAP.
@@ -51,7 +51,7 @@ public class PdpStatus extends PdpMessage {
*/
private String description;
- private List<ToscaPolicyIdentifier> policies;
+ private List<ToscaConceptIdentifier> policies;
private String deploymentInstanceInfo;
private String properties;
private PdpStatistics statistics;
@@ -77,7 +77,7 @@ public class PdpStatus extends PdpMessage {
this.state = source.state;
this.healthy = source.healthy;
this.description = source.description;
- this.policies = PfUtils.mapList(source.policies, ToscaPolicyIdentifier::new, new ArrayList<>(0));
+ this.policies = PfUtils.mapList(source.policies, ToscaConceptIdentifier::new, new ArrayList<>(0));
this.deploymentInstanceInfo = source.deploymentInstanceInfo;
this.properties = source.properties;
this.statistics = (source.statistics == null ? null : new PdpStatistics(source.statistics));
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
index e3e33b454..bfd9dac95 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -32,8 +32,7 @@ import org.onap.policy.common.parameters.ObjectValidationResult;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Class to represent a group of all PDP's of the same pdp type running for a particular
@@ -44,8 +43,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifi
@Data
public class PdpSubGroup {
private String pdpType;
- private List<ToscaPolicyTypeIdentifier> supportedPolicyTypes;
- private List<ToscaPolicyIdentifier> policies;
+ private List<ToscaConceptIdentifier> supportedPolicyTypes;
+ private List<ToscaConceptIdentifier> policies;
private int currentInstanceCount;
private int desiredInstanceCount;
private Map<String, String> properties;
@@ -65,9 +64,9 @@ public class PdpSubGroup {
*/
public PdpSubGroup(@NonNull final PdpSubGroup source) {
this.pdpType = source.pdpType;
- this.supportedPolicyTypes = PfUtils.mapList(source.supportedPolicyTypes, ToscaPolicyTypeIdentifier::new,
+ this.supportedPolicyTypes = PfUtils.mapList(source.supportedPolicyTypes, ToscaConceptIdentifier::new,
new ArrayList<>(0));
- this.policies = PfUtils.mapList(source.policies, ToscaPolicyIdentifier::new, new ArrayList<>(0));
+ this.policies = PfUtils.mapList(source.policies, ToscaConceptIdentifier::new, new ArrayList<>(0));
this.currentInstanceCount = source.currentInstanceCount;
this.desiredInstanceCount = source.desiredInstanceCount;
this.properties = (source.properties == null ? null : new LinkedHashMap<>(source.properties));
@@ -87,9 +86,9 @@ public class PdpSubGroup {
result.validateNotNull("pdpType", pdpType);
// When doing PdpGroup Update operation, supported policy types and policies doesn't have to be validated.
if (!updateGroupFlow) {
- result.validateNotNullList("policies", policies, ToscaPolicyIdentifier::validatePapRest);
+ result.validateNotNullList("policies", policies, ToscaConceptIdentifier::validatePapRest);
result.validateNotNullList("supportedPolicyTypes", supportedPolicyTypes,
- ToscaPolicyTypeIdentifier::validatePapRest);
+ ToscaConceptIdentifier::validatePapRest);
if (supportedPolicyTypes != null && supportedPolicyTypes.isEmpty()) {
result.addResult(new ObjectValidationResult("supportedPolicyTypes", supportedPolicyTypes,
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 3474fccc1..27ad34e4a 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-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,8 +61,7 @@ import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.base.validation.annotations.VerifyKey;
import org.onap.policy.models.pdp.concepts.Pdp;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Class to represent a PDP subgroup in the database.
@@ -186,14 +185,14 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative<PdpSubGro
pdpSubgroup.setSupportedPolicyTypes(new ArrayList<>());
for (PfSearchableKey supportedPolicyTypeKey : supportedPolicyTypes) {
- ToscaPolicyTypeIdentifier supportedPolicyTypeIdent = new ToscaPolicyTypeIdentifier(
+ ToscaConceptIdentifier supportedPolicyTypeIdent = new ToscaConceptIdentifier(
supportedPolicyTypeKey.getName(), supportedPolicyTypeKey.getVersion());
pdpSubgroup.getSupportedPolicyTypes().add(supportedPolicyTypeIdent);
}
pdpSubgroup.setPolicies(new ArrayList<>());
for (PfConceptKey policyKey : policies) {
- ToscaPolicyIdentifier toscaPolicyIdentifier = new ToscaPolicyIdentifier();
+ ToscaConceptIdentifier toscaPolicyIdentifier = new ToscaConceptIdentifier();
toscaPolicyIdentifier.setName(policyKey.getName());
toscaPolicyIdentifier.setVersion(policyKey.getVersion());
pdpSubgroup.getPolicies().add(toscaPolicyIdentifier);
@@ -220,7 +219,7 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative<PdpSubGro
this.supportedPolicyTypes = new ArrayList<>();
if (pdpSubgroup.getSupportedPolicyTypes() != null) {
- for (ToscaPolicyTypeIdentifier supportedPolicyType : pdpSubgroup.getSupportedPolicyTypes()) {
+ for (ToscaConceptIdentifier supportedPolicyType : pdpSubgroup.getSupportedPolicyTypes()) {
this.supportedPolicyTypes
.add(new PfSearchableKey(supportedPolicyType.getName(), supportedPolicyType.getVersion()));
}
@@ -228,7 +227,7 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative<PdpSubGro
this.policies = new ArrayList<>();
if (pdpSubgroup.getPolicies() != null) {
- for (ToscaPolicyIdentifier toscaPolicyIdentifier : pdpSubgroup.getPolicies()) {
+ for (ToscaConceptIdentifier toscaPolicyIdentifier : pdpSubgroup.getPolicies()) {
this.policies
.add(new PfConceptKey(toscaPolicyIdentifier.getName(), toscaPolicyIdentifier.getVersion()));
}