aboutsummaryrefslogtreecommitdiffstats
path: root/models-base/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'models-base/src/main/java/org')
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java4
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfNameVersion.java18
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfObjectFilter.java15
3 files changed, 26 insertions, 11 deletions
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
index 4c2cf0c4f..d2015eb7e 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
@@ -198,9 +198,9 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
}
incomingConceptEntry.getValue().setName(findConceptField(conceptKey, conceptKey.getName(),
- incomingConceptEntry.getValue(), PfNameVersion::getName));
+ incomingConceptEntry.getValue(), PfNameVersion::getDefinedName));
incomingConceptEntry.getValue().setVersion(findConceptField(conceptKey, conceptKey.getVersion(),
- incomingConceptEntry.getValue(), PfNameVersion::getVersion));
+ incomingConceptEntry.getValue(), PfNameVersion::getDefinedVersion));
C jpaConcept = getConceptNewInstance();
// This cast allows us to call the fromAuthorative method
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfNameVersion.java b/models-base/src/main/java/org/onap/policy/models/base/PfNameVersion.java
index f9fde53e5..4e4177004 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfNameVersion.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfNameVersion.java
@@ -38,6 +38,24 @@ public interface PfNameVersion {
public void setVersion(final String version);
/**
+ * Get the defined name for a concept, return null if no name is defined.
+ *
+ * @return the defined name
+ */
+ public default String getDefinedName() {
+ return getName();
+ }
+
+ /**
+ * Get the defined version for a concept, return null if no version is defined.
+ *
+ * @return the defined version
+ */
+ public default String getDefinedVersion() {
+ return getVersion();
+ }
+
+ /**
* Compare two name version implementation objects.
*
* @param left the left name/version implementation
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfObjectFilter.java b/models-base/src/main/java/org/onap/policy/models/base/PfObjectFilter.java
index f7e29f1b4..342fbab73 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfObjectFilter.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfObjectFilter.java
@@ -56,8 +56,7 @@ public interface PfObjectFilter<T> {
}
/**
- * Gets a predicate used to filter an item in a list by exactly matching an extracted value
- * with some text.
+ * Gets a predicate used to filter an item in a list by exactly matching an extracted value with some text.
*
* @param text the desired text to check against, or {@code null} if to accept everything
* @param extractor function to extract the value, to be matched, from a list item
@@ -73,11 +72,9 @@ public interface PfObjectFilter<T> {
}
/**
- * Gets a predicate used to filter an item in a list by comparing the start of an
- * extracted value with a prefix.
+ * Gets a predicate used to filter an item in a list by comparing the start of an extracted value with a prefix.
*
- * @param prefix the desired prefix to check against, or {@code null} if to accept
- * everything
+ * @param prefix the desired prefix to check against, or {@code null} if to accept everything
* @param extractor function to extract the value, to be matched, from a list item
* @return a predicate to match a prefix with a value from a list item
*/
@@ -94,8 +91,7 @@ public interface PfObjectFilter<T> {
}
/**
- * Gets a predicate used to filter an item in a list by matching an extracted value
- * with a regular expression.
+ * Gets a predicate used to filter an item in a list by matching an extracted value with a regular expression.
*
* @param pattern regular expression to match, or {@code null} if to accept everything
* @param extractor function to extract the value, to be matched, from a list item
@@ -140,7 +136,8 @@ public interface PfObjectFilter<T> {
* The list is sorted so if the last element name is the same as the current element name, the current
* element should be removed.
*/
- if (!((PfNameVersion) curElement).getName().equals(((PfNameVersion) lastElement).getName())) {
+ if (PfUtils.compareObjects(((PfNameVersion) curElement).getName(),
+ ((PfNameVersion) lastElement).getName()) != 0) {
// have a new name - done comparing with the old "current"
++icur;
}