Refactor key version check 16/143016/2
authordanielhanrahan <daniel.hanrahan@est.tech>
Mon, 5 Jan 2026 15:34:27 +0000 (15:34 +0000)
committerdanielhanrahan <daniel.hanrahan@est.tech>
Mon, 26 Jan 2026 14:47:56 +0000 (14:47 +0000)
Issue-ID: POLICY-5509
Change-Id: I11ddd0d0ba2ae4279c42998e52ce6cec1e9cb384
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
models/src/main/java/org/onap/policy/clamp/models/acm/document/concepts/DocToscaCapabilityType.java
models/src/main/java/org/onap/policy/clamp/models/acm/document/concepts/DocToscaWithToscaProperties.java

index af6d942..be1d030 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation.
+ *  Copyright (C) 2022-2026 OpenInfra Foundation Europe. 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.
@@ -62,6 +62,10 @@ public class DocToscaCapabilityType extends DocToscaWithToscaProperties<ToscaCap
 
     @Override
     public BeanValidationResult validate(@NonNull String fieldName) {
-        return validateWithKey(fieldName);
+        var result = super.validate(fieldName);
+
+        validateKeyVersionNotNull(result, "key", getConceptKey());
+
+        return result;
     }
 }
index 5aa3aad..b961222 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022,2024-2025 OpenInfra Foundation Europe. All rights reserved.
+ *  Copyright (C) 2022-2026 OpenInfra Foundation Europe. 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.
@@ -30,11 +30,9 @@ import java.util.stream.Collectors;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
-import lombok.NonNull;
 import org.apache.commons.collections4.CollectionUtils;
 import org.onap.policy.clamp.models.acm.document.base.DocConceptKey;
 import org.onap.policy.clamp.models.acm.document.base.DocUtil;
-import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.parameters.annotations.NotBlank;
 import org.onap.policy.common.parameters.annotations.NotNull;
 import org.onap.policy.common.parameters.annotations.Valid;
@@ -70,20 +68,6 @@ public class DocToscaWithToscaProperties<T extends ToscaWithToscaProperties> ext
         return tosca;
     }
 
-    /**
-     * Validates the fields of the object, including its key.
-     *
-     * @param fieldName name of the field containing this
-     * @return the result, or {@code null}
-     */
-    protected BeanValidationResult validateWithKey(@NonNull String fieldName) {
-        var result = super.validate(fieldName);
-
-        validateKeyVersionNotNull(result, "key", getConceptKey());
-
-        return result;
-    }
-
     @Override
     public void fromAuthorative(T authorativeConcept) {
         super.fromAuthorative(authorativeConcept);