Refactor clamp models to isolate any business logic 65/143365/2
authorFrancescoFioraEst <francesco.fiora@est.tech>
Tue, 20 Jan 2026 13:42:41 +0000 (13:42 +0000)
committerFrancesco Fiora <francesco.fiora@est.tech>
Mon, 23 Feb 2026 16:05:04 +0000 (16:05 +0000)
Issue-ID: POLICY-5549
Change-Id: Ib92ff2a261882050932f1c72fe1c784a7d62ebc6
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
15 files changed:
models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeploy.java
models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementRestart.java
models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
models/src/main/java/org/onap/policy/clamp/models/acm/document/base/DocConceptKey.java
models/src/main/java/org/onap/policy/clamp/models/acm/document/base/DocUtil.java
models/src/main/java/org/onap/policy/clamp/models/acm/document/base/ToscaServiceTemplateValidation.java
models/src/test/java/org/onap/policy/clamp/models/acm/document/concepts/DocToscaServiceTemplateTest.java
policy-models/src/main/java/org/onap/policy/models/base/PfConcept.java
policy-models/src/main/java/org/onap/policy/models/base/PfConceptKey.java
policy-models/src/main/java/org/onap/policy/models/base/PfKey.java
policy-models/src/main/java/org/onap/policy/models/base/PfKeyImpl.java
policy-models/src/main/java/org/onap/policy/models/base/PfUtils.java
policy-models/src/main/java/org/onap/policy/models/base/validation/annotations/VerifyKeyValidator.java
policy-models/src/test/java/org/onap/policy/models/base/PfConceptKeyTest.java
policy-models/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java

index 1ab8456..645f3a5 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2023-2025 OpenInfra Foundation Europe. All rights reserved.
+ * Copyright (C) 2023-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.
@@ -28,7 +28,6 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.NonNull;
 import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
-import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfUtils;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
@@ -44,7 +43,7 @@ public class AcElementDeploy {
     private UUID id = UUID.randomUUID();
 
     @NonNull
-    private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
+    private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfUtils.getNullKey());
 
     @NonNull
     private DeployOrder orderedState = DeployOrder.DEPLOY;
index e80fa5e..d908304 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2023-2025 OpenInfra Foundation Europe. All rights reserved.
+ *  Copyright (C) 2023-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.
@@ -27,7 +27,6 @@ import java.util.function.UnaryOperator;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.NonNull;
-import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfUtils;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
@@ -40,7 +39,7 @@ public class AcElementRestart {
     private UUID id = UUID.randomUUID();
 
     @NonNull
-    private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
+    private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfUtils.getNullKey());
 
     private UUID participantId;
 
index 54ab132..8e6b188 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
+ * Copyright (C) 2021-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.
@@ -28,7 +28,7 @@ import lombok.NoArgsConstructor;
 import lombok.NonNull;
 import lombok.ToString;
 import org.onap.policy.clamp.models.acm.utils.AcmUtils;
-import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfUtils;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
 
 /**
@@ -42,7 +42,7 @@ public class AutomationCompositionElement {
     private UUID id = UUID.randomUUID();
 
     @NonNull
-    private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
+    private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfUtils.getNullKey());
 
     @NonNull
     private UUID participantId = UUID.randomUUID();
index 7044b1c..eaa3d30 100644 (file)
@@ -23,14 +23,12 @@ package org.onap.policy.clamp.models.acm.document.base;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import jakarta.validation.constraints.Pattern;
 import java.io.Serial;
-import java.util.List;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import lombok.ToString;
 import org.onap.policy.common.utils.validation.Assertions;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfKeyImpl;
 
 @Data
@@ -54,12 +52,6 @@ public class DocConceptKey extends PfKeyImpl {
         this(NULL_KEY_NAME, NULL_KEY_VERSION);
     }
 
-    @Override
-    @JsonIgnore
-    public String getId() {
-        return name + ":" + version;
-    }
-
     /**
      * Copy constructor.
      *
@@ -94,10 +86,4 @@ public class DocConceptKey extends PfKeyImpl {
     public PfKeyImpl getKey() {
         return this;
     }
-
-    @Override
-    @JsonIgnore
-    public List<PfKey> getKeys() {
-        return super.getKeys();
-    }
 }
index 55b62f0..f466f14 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022,2025 OpenInfra Foundation Europe. All rights reserved.
+ *  Copyright (C) 2022,2025-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.
@@ -42,6 +42,7 @@ import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfModelRuntimeException;
 import org.onap.policy.models.base.PfNameVersion;
+import org.onap.policy.models.base.PfUtils;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
 
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
@@ -134,7 +135,7 @@ public final class DocUtil {
             var authoritiveImpl = mapFunc.apply(incomingConceptEntry.getValue());
 
             // After all that, save the map entry
-            conceptMap.put(conceptKey.getId(), authoritiveImpl);
+            conceptMap.put(PfUtils.getId(conceptKey), authoritiveImpl);
         }
 
         return conceptMap;
@@ -148,8 +149,9 @@ public final class DocUtil {
         if (StringUtils.isBlank(conceptField) || keyFieldValue.equals(conceptField)) {
             return keyFieldValue;
         } else {
-            throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Key " + conceptKey.getId() + " field "
-                    + keyFieldValue + " does not match the value " + conceptField + " in the concept field");
+            var msg = "Key " + PfUtils.getId(conceptKey) + " field "
+                    + keyFieldValue + " does not match the value " + conceptField + " in the concept field";
+            throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, msg);
         }
     }
 
@@ -300,7 +302,7 @@ public final class DocUtil {
     private static <A extends DocToscaEntity<?>> Set<String> toSetToscaReferences(Map<String, A> map) {
         Set<String> result = new HashSet<>();
         for (var entity : map.values()) {
-            result.add(entity.getDocConceptKey().getId()); // ref for type
+            result.add(PfUtils.getId(entity.getDocConceptKey())); // ref for type
             result.add(entity.getDocConceptKey().getName()); // ref for derived from
         }
         return result;
index b1ff46b..d620855 100644 (file)
@@ -32,6 +32,7 @@ import org.onap.policy.clamp.models.acm.document.concepts.DocToscaServiceTemplat
 import org.onap.policy.clamp.models.acm.document.concepts.DocToscaTopologyTemplate;
 import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.parameters.ValidationStatus;
+import org.onap.policy.models.base.PfUtils;
 
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
 public final class ToscaServiceTemplateValidation {
@@ -153,7 +154,8 @@ public final class ToscaServiceTemplateValidation {
             final Collection<DocConceptKey> dataTypeKeyCollection, Map<String, Set<String>> references) {
         for (DocConceptKey dataTypeKey : dataTypeKeyCollection) {
             if (!isTypePresent(dataTypeKey, references.get(DocUtil.REF_DATA_TYPES))) {
-                result.addResult("data type", dataTypeKey.getId(), ValidationStatus.INVALID, NOT_FOUND);
+                result.addResult(
+                        "data type", PfUtils.getId(dataTypeKey), ValidationStatus.INVALID, NOT_FOUND);
             }
         }
     }
@@ -198,7 +200,7 @@ public final class ToscaServiceTemplateValidation {
         if (reference.isEmpty()) {
             return false;
         }
-        return reference.contains(key.getId());
+        return reference.contains(PfUtils.getId(key));
     }
 
     private static String extractDerivedFrom(DocToscaEntity<?> entityType, final BeanValidationResult result) {
@@ -211,7 +213,7 @@ public final class ToscaServiceTemplateValidation {
             return null;
         }
         if (entityType.getName().equals(parentEntityTypeKey)) {
-            result.addResult("entity type", entityType.getDocConceptKey().getId(), ValidationStatus.INVALID,
+            result.addResult("entity type", PfUtils.getId(entityType.getDocConceptKey()), ValidationStatus.INVALID,
                     "ancestor of itself");
             return null;
         }
index 6abd535..130f294 100644 (file)
@@ -235,6 +235,5 @@ class DocToscaServiceTemplateTest {
         assertThatThrownBy(() -> docConceptKey.setName(null)).   isInstanceOf(NullPointerException.class);
         assertThatThrownBy(() -> docConceptKey.setVersion(null)).   isInstanceOf(NullPointerException.class);
         assertEquals("NULL", docConceptKey.getKey().getName());
-        assertThat(docConceptKey.getKeys()).hasSize(1);
     }
 }
index ae8983b..695ffbf 100644 (file)
@@ -23,7 +23,6 @@ package org.onap.policy.models.base;
 
 import java.io.Serial;
 import java.io.Serializable;
-import java.util.List;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import lombok.NonNull;
@@ -54,37 +53,6 @@ public abstract class PfConcept implements Serializable, Comparable<PfConcept> {
      */
     public abstract PfKey getKey();
 
-    /**
-     * Gets a list of all keys for this concept and all concepts that are defined or referenced by this concept and its
-     * sub-concepts.
-     *
-     * @return the keys used by this concept and its contained concepts
-     */
-    public abstract List<PfKey> getKeys();
-
-    /**
-     * Clean this concept, tidy up any superfluous information such as leading and trailing white space.
-     */
-    public abstract void clean();
-
-    @Override
-    public abstract boolean equals(Object otherObject);
-
-    @Override
-    public abstract String toString();
-
-    @Override
-    public abstract int hashCode();
-
-    /**
-     * Gets the ID string of this concept.
-     *
-     * @return the ID string of this concept
-     */
-    public String getId() {
-        return getKey().getId();
-    }
-
     /**
      * Gets the name of this concept.
      *
@@ -102,15 +70,4 @@ public abstract class PfConcept implements Serializable, Comparable<PfConcept> {
     public String getVersion() {
         return getKey().getVersion();
     }
-
-    /**
-     * Checks if this key matches the given key ID.
-     *
-     * @param id the key ID to match against
-     * @return true, if this key matches the ID
-     */
-    public final boolean matchesId(@NonNull final String id) {
-        // Check the ID
-        return getId().equals(id);
-    }
 }
index 2d3255c..11dacce 100644 (file)
@@ -33,8 +33,7 @@ import org.onap.policy.common.utils.validation.Assertions;
 
 /**
  * A concept key uniquely identifies every first order entity in the system. Every first order concept in the system
- * must have an {@link PfConceptKey} to identify it. Concepts that are wholly contained in another concept are
- * identified using a {@link PfReferenceKey} key.
+ * must have an {@link PfConceptKey} to identify it.
  *
  * <p>Key validation checks that the name and version fields match the NAME_REGEXP and VERSION_REGEXP
  * regular expressions respectively.
@@ -97,13 +96,4 @@ public class PfConceptKey extends PfKeyImpl {
     public void setVersion(@NonNull final String version) {
         this.version = Assertions.validateStringParameter(VERSION_TOKEN, version, getVersionRegEx());
     }
-
-    /**
-     * Get a null concept key.
-     *
-     * @return a null concept key
-     */
-    public static PfConceptKey getNullKey() {
-        return new PfConceptKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION);
-    }
 }
index e69f9f9..ed3a763 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019, 2023 Nordix Foundation.
+ *  Copyright (C) 2019, 2023,2026 OpenInfra Foundation Europe. All rights reserved.
  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -83,9 +83,6 @@ public abstract class PfKey extends PfConcept {
         super(copyConcept);
     }
 
-    @Override
-    public abstract String getId();
-
     /**
      * Return the result of a compatibility check of two keys.
      *
@@ -93,11 +90,4 @@ public abstract class PfKey extends PfConcept {
      * @return the compatibility result of the check
      */
     public abstract Compatibility getCompatibility(@NonNull PfKey otherKey);
-
-    /**
-     * Check if a key equals its null key.
-     *
-     * @return true, if the key is a null key
-     */
-    public abstract boolean isNullKey();
 }
index 5a84a92..2bd4554 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2020, 2023 Nordix Foundation.
+ *  Copyright (C) 2019-2020, 2023,2026 OpenInfra Foundation Europe. 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");
@@ -22,8 +22,6 @@
 package org.onap.policy.models.base;
 
 import java.io.Serial;
-import java.util.ArrayList;
-import java.util.List;
 import lombok.Getter;
 import lombok.NonNull;
 import lombok.ToString;
@@ -99,41 +97,6 @@ public abstract class PfKeyImpl extends PfKey {
         return this;
     }
 
-    @Override
-    public List<PfKey> getKeys() {
-        final List<PfKey> keyList = new ArrayList<>();
-        keyList.add(getKey());
-        return keyList;
-    }
-
-    @Override
-    public String getId() {
-        return getName() + ':' + getVersion();
-    }
-
-    @Override
-    public boolean isNullKey() {
-        return (PfKey.NULL_KEY_NAME.equals(getName()) && PfKey.NULL_KEY_VERSION.equals(getVersion()));
-    }
-
-    /**
-     * Determines if the name is "null".
-     *
-     * @return {@code true} if the name is null, {@code false} otherwise
-     */
-    public boolean isNullName() {
-        return PfKey.NULL_KEY_NAME.equals(getName());
-    }
-
-    /**
-     * Determines if the version is "null".
-     *
-     * @return {@code true} if the version is null, {@code false} otherwise
-     */
-    public boolean isNullVersion() {
-        return PfKey.NULL_KEY_VERSION.equals(getVersion());
-    }
-
     @Override
     public PfKey.Compatibility getCompatibility(@NonNull final PfKey otherKey) {
         if (!(otherKey instanceof PfKeyImpl otherConceptKey)) {
@@ -163,12 +126,6 @@ public abstract class PfKeyImpl extends PfKey {
         return Compatibility.PATCH;
     }
 
-    @Override
-    public void clean() {
-        setName(getName());
-        setVersion(getVersion());
-    }
-
     @Override
     public int compareTo(@NonNull final PfConcept otherObj) {
         Assertions.argumentNotNull(otherObj, "comparison object may not be null");
index eb7f201..165f1f4 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2021, 2023-2024 Nordix Foundation.
+ *  Copyright (C) 2019-2021, 2023-2024,2026 OpenInfra Foundation Europe. 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");
@@ -41,6 +41,55 @@ import org.apache.commons.collections4.MapUtils;
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
 public final class PfUtils {
 
+    /**
+     * Gets the ID string of this concept.
+     *
+     * @param key  the PfKey object
+     * @return the ID string of this concept
+     */
+    public static String getId(PfKey key) {
+        return key.getName() + ':' + key.getVersion();
+    }
+
+    /**
+     * Determines if the name is "null".
+     *
+     * @param key  the PfKeyImpl object
+     * @return {@code true} if the name is null, {@code false} otherwise
+     */
+    public static boolean isNullName(PfKeyImpl key) {
+        return PfKey.NULL_KEY_NAME.equals(key.getName());
+    }
+
+    /**
+     * Determines if the version is "null".
+     *
+     * @param key  the PfKeyImpl object
+     * @return {@code true} if the version is null, {@code false} otherwise
+     */
+    public static boolean isNullVersion(PfKeyImpl key) {
+        return PfKey.NULL_KEY_VERSION.equals(key.getVersion());
+    }
+
+    /**
+     * Check if a key equals its null key.
+     *
+     * @param key  the PfKey object
+     * @return true, if the key is a null key
+     */
+    public static boolean isNullKey(PfKey key) {
+        return (PfKey.NULL_KEY_NAME.equals(key.getName()) && PfKey.NULL_KEY_VERSION.equals(key.getVersion()));
+    }
+
+    /**
+     * Get a null concept key.
+     *
+     * @return a null concept key
+     */
+    public static PfConceptKey getNullKey() {
+        return new PfConceptKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION);
+    }
+
     /**
      * Compare two objects using their equals methods, nulls are allowed.
      *
index 33048d9..508ef5d 100644 (file)
@@ -24,6 +24,7 @@ import jakarta.validation.ConstraintValidator;
 import jakarta.validation.ConstraintValidatorContext;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfKeyImpl;
+import org.onap.policy.models.base.PfUtils;
 
 public class VerifyKeyValidator implements ConstraintValidator<VerifyKey, PfKey> {
 
@@ -43,19 +44,19 @@ public class VerifyKeyValidator implements ConstraintValidator<VerifyKey, PfKey>
         context.disableDefaultConstraintViolation();
         boolean valid = true;
 
-        if (annotation.keyNotNull() && pfkey.isNullKey()) {
+        if (annotation.keyNotNull() && PfUtils.isNullKey(pfkey)) {
             context.buildConstraintViolationWithTemplate("is a null key").addConstraintViolation();
             return false;
         }
 
-        if (pfkey instanceof PfKeyImpl keyimpl) {
-            if (annotation.nameNotNull() && keyimpl.isNullName()) {
+        if (pfkey instanceof PfKeyImpl keyImpl) {
+            if (annotation.nameNotNull() && PfUtils.isNullName(keyImpl)) {
                 context.buildConstraintViolationWithTemplate("is null")
                     .addPropertyNode("name").addConstraintViolation();
                 valid = false;
             }
 
-            if (annotation.versionNotNull() && keyimpl.isNullVersion()) {
+            if (annotation.versionNotNull() && PfUtils.isNullVersion(keyImpl)) {
                 context.buildConstraintViolationWithTemplate("is null")
                     .addPropertyNode("version").addConstraintViolation();
                 valid = false;
index 753cbe4..39d4a7a 100644 (file)
@@ -32,38 +32,27 @@ import org.junit.jupiter.api.Test;
 class PfConceptKeyTest {
 
     private static final String VERSION001 = "0.0.1";
-    private static final String ID_IS_NULL = "id is marked non-null but is null$";
 
     @Test
     void testConceptKey() {
         PfConceptKey someKey0 = new PfConceptKey();
-        assertEquals(PfConceptKey.getNullKey(), someKey0);
-        assertTrue(someKey0.isNullKey());
+        assertEquals(PfUtils.getNullKey(), someKey0);
+        assertTrue(PfUtils.isNullKey(someKey0));
         assertEquals("PfConceptKey(name=NULL, version=0.0.0)", someKey0.toString());
 
         PfConceptKey someKey1 = new PfConceptKey("my-name", VERSION001);
         PfConceptKey someKey2 = new PfConceptKey(someKey1);
-        PfConceptKey someKey3 = new PfConceptKey(someKey1.getId());
+        PfConceptKey someKey3 = new PfConceptKey(PfUtils.getId(someKey1));
         assertEquals(someKey1, someKey2);
         assertEquals(someKey1, someKey3);
-        assertFalse(someKey1.isNullVersion());
-        assertFalse(someKey1.isNullName());
+        assertFalse(PfUtils.isNullVersion(someKey1));
+        assertFalse(PfUtils.isNullName(someKey1));
         assertEquals("PfConceptKey(name=my-name, version=0.0.1)", someKey1.toString());
 
         assertEquals("my-name", someKey1.getName());
         assertEquals(VERSION001, someKey1.getVersion());
-
         assertEquals(someKey2, someKey1.getKey());
-        assertEquals(1, someKey1.getKeys().size());
-
-        PfConcept pfc = new PfConceptKey();
-        assertEquals(PfConceptKey.getNullKey().getId(), pfc.getId());
-
-        assertTrue(PfConceptKey.getNullKey().matchesId(pfc.getId()));
-
-        assertTrue(PfConceptKey.getNullKey().isNullKey());
-
-        assertThatThrownBy(() -> PfConceptKey.getNullKey().matchesId(null)).hasMessageMatching(ID_IS_NULL);
+        assertTrue(PfUtils.isNullKey(PfUtils.getNullKey()));
 
         assertThatThrownBy(() -> someKey0.setName(null)).isInstanceOf(NullPointerException.class)
             .hasMessageMatching("^name is marked non-null but is null$");
index f0b5bfc..3d3853f 100644 (file)
@@ -55,7 +55,6 @@ class PfKeyImplTest {
     private static final MyKey buildKey1 = new MyKey(NAME, "0.0.3+1");
     private static final MyKey buildKey2 = new MyKey(NAME, "0.1.0-1");
     private static final MyKey buildKey3 = new MyKey(NAME, "3.0.0-SNAPSHOT");
-    private static final MyKey buildKey4 = new MyKey(NAME, "1.0.0-rc.1");
 
     /**
      * Sets data in Keys for the tests.
@@ -67,7 +66,7 @@ class PfKeyImplTest {
         someKey0 = new MyKey();
         someKey1 = new MyKey(NAME, VERSION001);
         someKey2 = new MyKey(someKey1);
-        someKey3 = new MyKey(someKey1.getId());
+        someKey3 = new MyKey(PfUtils.getId(someKey1));
 
         someKey0.setName("zero");
         someKey0.setVersion("0.0.2");
@@ -95,24 +94,23 @@ class PfKeyImplTest {
         assertThatThrownBy(() -> new MyKey((MyKey) null))
             .hasMessageMatching("^copyConcept is marked non-null but is null$");
 
-        assertTrue(someKey.isNullKey());
+        assertTrue(PfUtils.isNullKey(someKey));
         assertEquals(new MyKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION), someKey);
 
         MyKey someKey11 = new MyKey(NAME, VERSION001);
         MyKey someKey22 = new MyKey(someKey11);
-        MyKey someKey33 = new MyKey(someKey11.getId());
+        MyKey someKey33 = new MyKey(PfUtils.getId(someKey11));
         assertEquals(someKey11, someKey22);
         assertEquals(someKey11, someKey33);
-        assertFalse(someKey11.isNullKey());
-        assertFalse(someKey11.isNullVersion());
+        assertFalse(PfUtils.isNullKey(someKey11));
+        assertFalse(PfUtils.isNullVersion(someKey11));
 
         assertEquals(someKey22, someKey11.getKey());
-        assertEquals(1, someKey11.getKeys().size());
     }
 
     @Test
     void testCompatibilityConceptKey() {
-        assertEquals("name:0.1.2", someKey4.getId());
+        assertEquals("name:0.1.2", PfUtils.getId(someKey4));
 
         assertThatThrownBy(() -> someKey0.getCompatibility(null)).isInstanceOf(NullPointerException.class)
             .hasMessageMatching("^otherKey is marked non-null but is null$");
@@ -135,7 +133,6 @@ class PfKeyImplTest {
 
     @Test
     void testCleanConceptKey() {
-        someKey0.clean();
         assertNotNull(someKey0.toString());
 
         MyKey someKey7 = new MyKey(someKey1);
@@ -151,7 +148,7 @@ class PfKeyImplTest {
 
         MyKey someKey8 = new MyKey();
         someKey8.setVersion(VERSION001);
-        assertFalse(someKey8.isNullKey());
+        assertFalse(PfUtils.isNullKey(someKey8));
     }
 
     @Test