aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-01-05 11:11:26 -0500
committerJim Hahn <jrh3@att.com>2021-01-06 15:59:14 -0500
commite6bea18abd1a1b4ddf7203508832e6a3f9380598 (patch)
tree90b8ae9fde32efcfb2f4662bcf2b87e4c430de60 /models-tosca/src
parentf2b0318f53abf9f2345a5cdca74f3dd635aa9b60 (diff)
Use annotations on parameterized types
Updated the code to place validation annotations directly on the annotated types instead of using the @Items and @Entries annotations. Also added/updated junits for validation code. Issue-ID: POLICY-2648 Change-Id: Ia535da07a38cec77a74c5c3215b5ae784d7a4e1a Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-tosca/src')
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java14
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java9
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java10
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java8
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java7
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java9
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java12
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java15
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java6
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.java9
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java11
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java6
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java7
13 files changed, 38 insertions, 85 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java
index 28e4cdc2a..1247a3e5a 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 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.
@@ -34,15 +34,12 @@ import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
-import org.onap.policy.common.parameters.annotations.Entries;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.utils.coder.YamlJsonTranslator;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.validation.annotations.PfItems;
import org.onap.policy.models.base.validation.annotations.PfMin;
import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityAssignment;
@@ -66,17 +63,14 @@ public class JpaToscaCapabilityAssignment extends JpaToscaEntityType<ToscaCapabi
@ElementCollection
@Lob
- @Entries(key = @Items(notNull = {@NotNull}), value = @Items(notNull = {@NotNull}))
- private Map<String, String> properties;
+ private Map<@NotNull String, @NotNull String> properties;
@ElementCollection
@Lob
- @Entries(key = @Items(notNull = {@NotNull}), value = @Items(notNull = {@NotNull}))
- private Map<String, String> attributes;
+ private Map<@NotNull String, @NotNull String> attributes;
@ElementCollection
- @PfItems(notNull = {@NotNull}, pfMin = {@PfMin(value = 0, allowed = -1)})
- private List<Integer> occurrences;
+ private List<@NotNull @PfMin(value = 0, allowed = -1) Integer> occurrences;
/**
* The Default Constructor creates a {@link JpaToscaCapabilityAssignment} object with a null key.
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java
index 40c50c04a..4803b65a7 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 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.
@@ -39,8 +39,6 @@ import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.collections4.CollectionUtils;
import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.parameters.annotations.Entries;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
import org.onap.policy.models.base.PfAuthorative;
@@ -68,8 +66,7 @@ public class JpaToscaCapabilityType extends JpaToscaEntityType<ToscaCapabilityTy
@ElementCollection
@Lob
- @Entries(key = @Items(notNull = {@NotNull}), value = @Items(notNull = {@NotNull}, valid = {@Valid}))
- private Map<String, JpaToscaProperty> properties;
+ private Map<@NotNull String, @NotNull @Valid JpaToscaProperty> properties;
/**
* The Default Constructor creates a {@link JpaToscaCapabilityType} object with a null key.
@@ -163,7 +160,7 @@ public class JpaToscaCapabilityType extends JpaToscaEntityType<ToscaCapabilityTy
public BeanValidationResult validate(@NonNull String fieldName) {
BeanValidationResult result = super.validate(fieldName);
- result.addResult(validateKeyVersionNotNull("key", getKey()));
+ validateKeyVersionNotNull(result, "key", getKey());
return result;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java
index 29daa3a47..515753167 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Model
* ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -41,8 +41,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.collections4.CollectionUtils;
-import org.onap.policy.common.parameters.annotations.Entries;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
import org.onap.policy.models.base.PfAuthorative;
@@ -70,13 +68,11 @@ public class JpaToscaDataType extends JpaToscaEntityType<ToscaDataType> implemen
private static final long serialVersionUID = -3922690413436539164L;
@ElementCollection
- @Items(notNull = {@NotNull}, valid = {@Valid})
- private List<JpaToscaConstraint> constraints;
+ private List<@NotNull @Valid JpaToscaConstraint> constraints;
@ElementCollection
@Lob
- @Entries(key = @Items(notNull = {@NotNull}), value = @Items(notNull = {@NotNull}, valid = {@Valid}))
- private Map<String, JpaToscaProperty> properties;
+ private Map<@NotNull String, @NotNull @Valid JpaToscaProperty> properties;
/**
* The Default Constructor creates a {@link JpaToscaDataType} object with a null key.
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java
index de3279ec4..893cdbe84 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.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.
@@ -35,8 +35,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.common.parameters.annotations.Entries;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.models.base.PfAuthorative;
@@ -73,9 +71,7 @@ public class JpaToscaEntityType<T extends ToscaEntity> extends PfConcept impleme
private PfConceptKey derivedFrom;
@ElementCollection
- @Entries(key = @Items(notNull = {@NotNull}, notBlank = {@NotBlank}),
- value = @Items(notNull = {@NotNull}, notBlank = {@NotBlank}))
- private Map<String, String> metadata;
+ private Map<@NotNull @NotBlank String, @NotNull @NotBlank String> metadata;
@Column
@NotBlank
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java
index c2dcab1ec..9a07ea187 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 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.
@@ -42,8 +42,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.common.parameters.annotations.Entries;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
@@ -79,8 +77,7 @@ public class JpaToscaNodeTemplate extends JpaToscaEntityType<ToscaNodeTemplate>
@ElementCollection
@Lob
- @Entries(key = @Items(notNull = {@NotNull}), value = @Items(notNull = {@NotNull}))
- private Map<String, String> properties;
+ private Map<@NotNull String, @NotNull String> properties;
// formatter:off
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java
index 0965d8b44..5ea21ed77 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 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.
@@ -45,8 +45,6 @@ import lombok.NonNull;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.parameters.annotations.Entries;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
import org.onap.policy.models.base.PfAuthorative;
@@ -73,8 +71,7 @@ public class JpaToscaNodeType extends JpaToscaEntityType<ToscaNodeType> implemen
@ElementCollection
@Lob
- @Entries(key = @Items(notNull = {@NotNull}), value = @Items(notNull = {@NotNull}, valid = {@Valid}))
- private Map<String, JpaToscaProperty> properties;
+ private Map<@NotNull String, @NotNull @Valid JpaToscaProperty> properties;
// formatter:off
@@ -193,7 +190,7 @@ public class JpaToscaNodeType extends JpaToscaEntityType<ToscaNodeType> implemen
public BeanValidationResult validate(String fieldName) {
BeanValidationResult result = super.validate(fieldName);
- result.addResult(validateKeyVersionNotNull("key", getKey()));
+ validateKeyVersionNotNull(result, "key", getKey());
return result;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
index 83ec403da..0be04353f 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Model
* ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -40,8 +40,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.parameters.annotations.Entries;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
@@ -90,12 +88,10 @@ public class JpaToscaPolicy extends JpaToscaEntityType<ToscaPolicy> implements P
@ElementCollection
@Lob
- @Entries(key = @Items(notNull = {@NotNull}, notBlank = {@NotBlank}), value = @Items(notNull = {@NotNull}))
- private Map<String, String> properties;
+ private Map<@NotNull @NotBlank String, @NotNull String> properties;
@ElementCollection
- @Items(notNull = {@NotNull}, valid = {@Valid})
- private List<PfConceptKey> targets;
+ private List<@NotNull @Valid PfConceptKey> targets;
// @formatter:on
/**
@@ -243,7 +239,7 @@ public class JpaToscaPolicy extends JpaToscaEntityType<ToscaPolicy> implements P
public BeanValidationResult validate(String fieldName) {
BeanValidationResult result = super.validate(fieldName);
- result.addResult(validateKeyVersionNotNull("key", getKey()));
+ validateKeyVersionNotNull(result, "key", getKey());
return result;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
index 07850f9de..ddde08985 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Model
* ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -41,8 +41,6 @@ import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.collections4.CollectionUtils;
import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.parameters.annotations.Entries;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
import org.onap.policy.models.base.PfAuthorative;
@@ -72,16 +70,13 @@ public class JpaToscaPolicyType extends JpaToscaEntityType<ToscaPolicyType> impl
@ElementCollection
@Lob
- @Entries(key = @Items(notNull = {@NotNull}), value = @Items(notNull = {@NotNull}, valid = {@Valid}))
- private Map<String, JpaToscaProperty> properties;
+ private Map<@NotNull String, @NotNull @Valid JpaToscaProperty> properties;
@ElementCollection
- @Items(notNull = {@NotNull}, valid = {@Valid})
- private List<PfConceptKey> targets;
+ private List<@NotNull @Valid PfConceptKey> targets;
@ElementCollection
- @Items(notNull = {@NotNull}, valid = {@Valid})
- private List<JpaToscaTrigger> triggers;
+ private List<@NotNull @Valid JpaToscaTrigger> triggers;
/**
* The Default Constructor creates a {@link JpaToscaPolicyType} object with a null key.
@@ -196,7 +191,7 @@ public class JpaToscaPolicyType extends JpaToscaEntityType<ToscaPolicyType> impl
public BeanValidationResult validate(String fieldName) {
BeanValidationResult result = super.validate(fieldName);
- result.addResult(validateKeyVersionNotNull("key", getKey()));
+ validateKeyVersionNotNull(result, "key", getKey());
return result;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
index 711fcd2cb..442063933 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Model
* ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -38,7 +38,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
@@ -92,8 +91,7 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative<ToscaPr
private Status status = Status.SUPPORTED;
@ElementCollection
- @Items(notNull = {@NotNull}, valid = {@Valid})
- private List<JpaToscaConstraint> constraints;
+ private List<@NotNull @Valid JpaToscaConstraint> constraints;
@Column
@Valid
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.java
index 1bd23b13f..1c7ead32f 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 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.
@@ -39,8 +39,6 @@ import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.collections4.CollectionUtils;
import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.parameters.annotations.Entries;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
import org.onap.policy.models.base.PfAuthorative;
@@ -68,8 +66,7 @@ public class JpaToscaRelationshipType extends JpaToscaEntityType<ToscaRelationsh
@ElementCollection
@Lob
- @Entries(key = @Items(notNull = {@NotNull}), value = @Items(notNull = {@NotNull}, valid = {@Valid}))
- private Map<String, JpaToscaProperty> properties;
+ private Map<@NotNull String, @NotNull @Valid JpaToscaProperty> properties;
/**
* The Default Constructor creates a {@link JpaToscaRelationshipType} object with a null key.
@@ -160,7 +157,7 @@ public class JpaToscaRelationshipType extends JpaToscaEntityType<ToscaRelationsh
public BeanValidationResult validate(String fieldName) {
BeanValidationResult result = super.validate(fieldName);
- result.addResult(validateKeyVersionNotNull("key", getKey()));
+ validateKeyVersionNotNull(result, "key", getKey());
return result;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java
index b223c2422..aeb93b3e7 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Requirement Model
* ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -37,15 +37,12 @@ import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
-import org.onap.policy.common.parameters.annotations.Entries;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.utils.coder.YamlJsonTranslator;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.validation.annotations.PfItems;
import org.onap.policy.models.base.validation.annotations.PfMin;
import org.onap.policy.models.tosca.authorative.concepts.ToscaRequirement;
@@ -77,13 +74,11 @@ public class JpaToscaRequirement extends JpaToscaEntityType<ToscaRequirement>
private String relationship;
@ElementCollection
- @PfItems(notNull = {@NotNull}, pfMin = {@PfMin(value = 0, allowed = -1)})
- private List<Integer> occurrences;
+ private List<@NotNull @PfMin(value = 0, allowed = -1) Integer> occurrences;
@ElementCollection
@Lob
- @Entries(key = @Items(notNull = {@NotNull}), value = @Items(notNull = {@NotNull}))
- private Map<String, String> properties;
+ private Map<@NotNull String, @NotNull String> properties;
/**
* The Default Constructor creates a {@link JpaToscaRequirement} object with a null key.
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java
index 1651d1a93..f7619c951 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Model
* ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,7 +33,6 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
@@ -71,8 +70,7 @@ public class JpaToscaSchemaDefinition extends Validated
private String description;
@ElementCollection
- @Items(notNull = {@NotNull}, valid = {@Valid})
- private List<JpaToscaConstraint> constraints;
+ private List<@NotNull @Valid JpaToscaConstraint> constraints;
/**
* The full constructor creates a {@link JpaToscaSchemaDefinition} object with mandatory fields.
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java
index 7f2920c91..86add360a 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.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.
@@ -43,8 +43,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.common.parameters.annotations.Entries;
-import org.onap.policy.common.parameters.annotations.Items;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
@@ -86,8 +84,7 @@ public class JpaToscaTopologyTemplate extends PfConcept implements PfAuthorative
// @formatter:off
@ElementCollection
@Lob
- @Entries(key = @Items(notNull = {@NotNull}), value = @Items(notNull = {@NotNull}, valid = {@Valid}))
- private Map<String, JpaToscaParameter> inputs;
+ private Map<@NotNull String, @NotNull @Valid JpaToscaParameter> inputs;
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumns(