From 3b00f1c32b89282dcbb74d3d3645e263f005319e Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 26 Apr 2021 17:41:25 -0400 Subject: 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. Added Size annotation, used to verify minimum lengths of maps and collections. Added ClassName annotation, used to verify that a property contains the name of a class that is actually in the classpath. Added another addResult() method to make it easier when replacing calls to GroupValidationResult setResult() method with BeanValidationResult. Issue-ID: POLICY-2059 Change-Id: Id4da24886908723006624c5d53edeb034102299d Signed-off-by: Jim Hahn --- .../policy/common/endpoints/parameters/RestServerParameters.java | 4 ++-- .../policy/common/endpoints/parameters/TopicParameterGroup.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'policy-endpoints/src/main/java/org/onap/policy/common/endpoints') diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java index 53154b9e..57aeb9dc 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2020-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. @@ -32,10 +32,10 @@ import org.onap.policy.common.parameters.annotations.NotNull; * * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ -@NotNull @NotBlank @Getter public class RestServerParameters extends ParameterGroupImpl { + @NotNull private String host; @Min(value = 1) diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/TopicParameterGroup.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/TopicParameterGroup.java index 4cd3893d..427f0882 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/TopicParameterGroup.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/TopicParameterGroup.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 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. @@ -25,7 +25,7 @@ import java.util.List; import lombok.Getter; import lombok.Setter; import org.apache.commons.lang3.StringUtils; -import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.common.parameters.ParameterGroupImpl; import org.onap.policy.common.parameters.ValidationStatus; import org.onap.policy.common.parameters.annotations.NotBlank; @@ -53,8 +53,8 @@ public class TopicParameterGroup extends ParameterGroupImpl { * {@inheritDoc}. */ @Override - public GroupValidationResult validate() { - GroupValidationResult result = super.validate(); + public BeanValidationResult validate() { + BeanValidationResult result = super.validate(); if (result.isValid()) { StringBuilder errorMsg = new StringBuilder(); StringBuilder missingSourceParams = checkMissingMandatoryParams(topicSources); -- cgit 1.2.3-korg