aboutsummaryrefslogtreecommitdiffstats
path: root/models-pdp/src/main/java/org
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-04-26 18:16:36 -0400
committerJim Hahn <jrh3@att.com>2021-04-29 11:35:02 -0400
commit4fdecb037bd2609a6b977adba6d2f263c977d9e1 (patch)
treecac0861d73c073e33e2b677fc6c9356e3dcf3574 /models-pdp/src/main/java/org
parent6e589fc31f69482d2cf5bf57c733094394439b0f (diff)
Remove GroupValidationResult
Removed GroupValidationResult, replacing it with BeanValidationResult. Modified the ParameterGroup subclasses to use BeanValidator, adding annotations where needed to trigger the validations that had been automatically performed by GroupValidationResult. Issue-ID: POLICY-2059 Change-Id: I245e4a647fcbb718faa63a7543f9f81c85da958c Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-pdp/src/main/java/org')
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroup.java10
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java9
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java9
3 files changed, 10 insertions, 18 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroup.java
index d98f6ed30..8746c0721 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroup.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import org.onap.policy.common.parameters.BeanValidationResult;
-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;
@@ -70,8 +69,7 @@ public class DeploymentGroup {
result.validateNotNullList(SUBGROUP_FIELD, deploymentSubgroups, DeploymentSubGroup::validatePapRest);
if (deploymentSubgroups != null && deploymentSubgroups.isEmpty()) {
- result.addResult(new ObjectValidationResult(SUBGROUP_FIELD, deploymentSubgroups, ValidationStatus.INVALID,
- "is empty"));
+ result.addResult(SUBGROUP_FIELD, deploymentSubgroups, ValidationStatus.INVALID, "is empty");
}
checkDuplicateSubgroups(result);
@@ -102,8 +100,8 @@ public class DeploymentGroup {
if (curact != null && action == Action.PATCH) {
BeanValidationResult subResult = new BeanValidationResult(pdpType, pdpType);
- subResult.addResult(new ObjectValidationResult("action", action, ValidationStatus.INVALID,
- "incompatible with previous action: " + curact));
+ subResult.addResult("action", action, ValidationStatus.INVALID,
+ "incompatible with previous action: " + curact);
BeanValidationResult subResult2 = new BeanValidationResult(SUBGROUP_FIELD, subgrp);
subResult2.addResult(subResult);
result.addResult(subResult2);
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
index b6886bef1..6d7607924 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property.
+ * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,6 @@ import java.util.stream.Collectors;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.onap.policy.common.parameters.BeanValidationResult;
-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.PfKey;
@@ -96,8 +95,7 @@ public class PdpGroup implements PfNameVersion, Comparable<PdpGroup> {
(PdpSubGroup pdpSubGroup) -> pdpSubGroup.validatePapRest(updateGroupFlow));
if (pdpSubgroups != null && pdpSubgroups.isEmpty()) {
- result.addResult(new ObjectValidationResult(SUBGROUP_FIELD, pdpSubgroups, ValidationStatus.INVALID,
- "is empty"));
+ result.addResult(SUBGROUP_FIELD, pdpSubgroups, ValidationStatus.INVALID, "is empty");
}
checkDuplicateSubgroups(result);
@@ -122,8 +120,7 @@ public class PdpGroup implements PfNameVersion, Comparable<PdpGroup> {
}
// different sizes implies duplicates
- result.addResult(new ObjectValidationResult(SUBGROUP_FIELD, pdpTypes, ValidationStatus.INVALID,
- "duplicate subgroups"));
+ result.addResult(SUBGROUP_FIELD, pdpTypes, ValidationStatus.INVALID, "duplicate subgroups");
}
@Override
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 bfd9dac95..0e9554d03 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,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2021 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@ import java.util.Map;
import lombok.Data;
import lombok.NonNull;
import org.onap.policy.common.parameters.BeanValidationResult;
-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;
@@ -91,14 +90,12 @@ public class PdpSubGroup {
ToscaConceptIdentifier::validatePapRest);
if (supportedPolicyTypes != null && supportedPolicyTypes.isEmpty()) {
- result.addResult(new ObjectValidationResult("supportedPolicyTypes", supportedPolicyTypes,
- ValidationStatus.INVALID, "empty list"));
+ result.addResult("supportedPolicyTypes", supportedPolicyTypes, ValidationStatus.INVALID, "empty list");
}
}
if (desiredInstanceCount <= 0) {
- result.addResult(new ObjectValidationResult("desiredInstanceCount", desiredInstanceCount,
- ValidationStatus.INVALID, "non-positive"));
+ result.addResult("desiredInstanceCount", desiredInstanceCount, ValidationStatus.INVALID, "non-positive");
}
return result;