summaryrefslogtreecommitdiffstats
path: root/models-base
diff options
context:
space:
mode:
Diffstat (limited to 'models-base')
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfConcept.java6
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java11
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfKey.java5
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java10
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfModel.java6
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java6
6 files changed, 24 insertions, 20 deletions
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java
index 394eb89f2..2357ec00d 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019-2020 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.
@@ -36,7 +36,7 @@ public abstract class PfConcept extends Validated implements Serializable, Compa
/**
* Default constructor.
*/
- public PfConcept() {
+ protected PfConcept() {
// Default Constructor
}
@@ -45,7 +45,7 @@ public abstract class PfConcept extends Validated implements Serializable, Compa
*
* @param copyConcept the concept to copy from
*/
- public PfConcept(@NonNull final PfConcept copyConcept) {
+ protected PfConcept(@NonNull final PfConcept copyConcept) {
// nothing else to do (other than @NonNull check)
}
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 d2015eb7e..e7cab460e 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
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019-2020 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.
@@ -72,6 +72,7 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
implements PfConceptGetter<C>, PfAuthorative<List<Map<String, A>>> {
private static final long serialVersionUID = -324211738823208318L;
+ private static final String VALUE_FIELD = "value";
private static final Pattern KEY_ID_PATTERN = Pattern.compile(PfKey.KEY_ID_REGEXP);
@EmbeddedId
@@ -268,14 +269,14 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
addResult(result, "key on concept entry", conceptEntry.getKey(), IS_A_NULL_KEY);
} else if (conceptEntry.getValue() == null) {
result2 = new BeanValidationResult(conceptEntry.getKey().getId(), conceptEntry.getKey());
- addResult(result2, "value", conceptEntry.getValue(), IS_NULL);
+ addResult(result2, VALUE_FIELD, conceptEntry.getValue(), IS_NULL);
} else if (!conceptEntry.getKey().equals(conceptEntry.getValue().getKey())) {
result2 = new BeanValidationResult(conceptEntry.getKey().getId(), conceptEntry.getKey());
- addResult(result2, "value", conceptEntry.getValue(), "does not equal concept key");
- result2.addResult(conceptEntry.getValue().validate("value"));
+ addResult(result2, VALUE_FIELD, conceptEntry.getValue(), "does not equal concept key");
+ result2.addResult(conceptEntry.getValue().validate(VALUE_FIELD));
} else {
result2 = new BeanValidationResult(conceptEntry.getKey().getId(), conceptEntry.getKey());
- result2.addResult(conceptEntry.getValue().validate("value"));
+ result2.addResult(conceptEntry.getValue().validate(VALUE_FIELD));
}
result.addResult(result2);
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfKey.java
index f38689a04..4b7f8cf95 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfKey.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfKey.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 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.
@@ -69,7 +70,7 @@ public abstract class PfKey extends PfConcept {
/**
* Default constructor.
*/
- public PfKey() {
+ protected PfKey() {
super();
}
@@ -78,7 +79,7 @@ public abstract class PfKey extends PfConcept {
*
* @param copyConcept the concept to copy from
*/
- public PfKey(final PfKey copyConcept) {
+ protected PfKey(final PfKey copyConcept) {
super(copyConcept);
}
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java b/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java
index bfeb870c1..b6d12198c 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019-2020 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.
@@ -42,7 +42,7 @@ public abstract class PfKeyImpl extends PfKey {
/**
* The default constructor creates a null concept key.
*/
- public PfKeyImpl() {
+ protected PfKeyImpl() {
this(NULL_KEY_NAME, NULL_KEY_VERSION);
}
@@ -51,7 +51,7 @@ public abstract class PfKeyImpl extends PfKey {
*
* @param copyConcept the concept to copy from
*/
- public PfKeyImpl(final PfKeyImpl copyConcept) {
+ protected PfKeyImpl(final PfKeyImpl copyConcept) {
super(copyConcept);
setName(copyConcept.getName());
setVersion(copyConcept.getVersion());
@@ -63,7 +63,7 @@ public abstract class PfKeyImpl extends PfKey {
* @param name the key name
* @param version the key version
*/
- public PfKeyImpl(@NonNull final String name, @NonNull final String version) {
+ protected PfKeyImpl(@NonNull final String name, @NonNull final String version) {
super();
setName(name);
setVersion(version);
@@ -74,7 +74,7 @@ public abstract class PfKeyImpl extends PfKey {
*
* @param id the key ID in a format that respects the KEY_ID_REGEXP
*/
- public PfKeyImpl(@NonNull final String id) {
+ protected PfKeyImpl(@NonNull final String id) {
// Check the incoming ID is valid
Assertions.validateStringParameter("id", id, getKeyIdRegEx());
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModel.java b/models-base/src/main/java/org/onap/policy/models/base/PfModel.java
index bdd652a92..8cdcb90b7 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfModel.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfModel.java
@@ -72,7 +72,7 @@ public abstract class PfModel extends PfConcept {
/**
* The Default Constructor creates this concept with a NULL artifact key.
*/
- public PfModel() {
+ protected PfModel() {
this(new PfConceptKey());
}
@@ -81,7 +81,7 @@ public abstract class PfModel extends PfConcept {
*
* @param key the key of this concept
*/
- public PfModel(@NonNull final PfConceptKey key) {
+ protected PfModel(@NonNull final PfConceptKey key) {
super();
Assertions.argumentNotNull(key, "key may not be null");
@@ -93,7 +93,7 @@ public abstract class PfModel extends PfConcept {
*
* @param copyConcept the concept to copy from
*/
- public PfModel(@NonNull final PfModel copyConcept) {
+ protected PfModel(@NonNull final PfModel copyConcept) {
super(copyConcept);
this.key = new PfConceptKey(copyConcept.key);
}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java b/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java
index 91fa301f9..8fa757a00 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java
@@ -110,7 +110,8 @@ public class ValidatedTest {
BeanValidationResult result2 = new BeanValidationResult("", this);
// null parameter tests
- assertThatThrownBy(() -> Validated.validateKeyNotNull(result2, null, new PfConceptKey()))
+ PfConceptKey conceptKey = new PfConceptKey();
+ assertThatThrownBy(() -> Validated.validateKeyNotNull(result2, null, conceptKey))
.isInstanceOf(NullPointerException.class);
assertThatCode(() -> Validated.validateKeyNotNull(result2, MY_FIELD, null)).doesNotThrowAnyException();
@@ -131,7 +132,8 @@ public class ValidatedTest {
assertThat(result.getResult()).contains(MY_FIELD).contains("version").contains(Validated.IS_NULL);
BeanValidationResult result2 = new BeanValidationResult("", this);
- assertThatThrownBy(() -> Validated.validateKeyVersionNotNull(result2, null, new PfConceptKey()))
+ PfConceptKey conceptKey = new PfConceptKey();
+ assertThatThrownBy(() -> Validated.validateKeyVersionNotNull(result2, null, conceptKey))
.isInstanceOf(NullPointerException.class);
assertThatCode(() -> Validated.validateKeyVersionNotNull(result2, MY_FIELD, null)).doesNotThrowAnyException();