aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2021-05-11 12:28:31 +0000
committerGerrit Code Review <gerrit@onap.org>2021-05-11 12:28:31 +0000
commit385e119cf90ee2ba83377115c98b3cf60f993158 (patch)
tree085f8c6952a968a8b72e2c9e82eb6f8dda25d5cd
parent957542e0c71f82f260d474d680473238451e4052 (diff)
parent6b6eb52ef3111142ba2dc9afb85cdd48dc0454ca (diff)
Merge "Fix sonars in policy models"
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroup.java8
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroups.java4
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java4
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java2
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java4
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java2
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java2
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java4
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java6
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java4
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java8
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java23
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProvider.java11
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java6
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java6
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java2
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java10
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java3
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java4
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java4
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java4
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithToscaProperties.java4
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java32
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java8
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java3
38 files changed, 95 insertions, 99 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroup.java
index 8746c0721..79e5e79b9 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroup.java
@@ -63,7 +63,7 @@ public class DeploymentGroup {
* @return the validation result
*/
public ValidationResult validatePapRest() {
- BeanValidationResult result = new BeanValidationResult("group", this);
+ var result = new BeanValidationResult("group", this);
result.validateNotNull("name", name);
result.validateNotNullList(SUBGROUP_FIELD, deploymentSubgroups, DeploymentSubGroup::validatePapRest);
@@ -94,15 +94,15 @@ public class DeploymentGroup {
Map<String, Action> pdpType2action = new HashMap<>();
for (DeploymentSubGroup subgrp : deploymentSubgroups) {
- Action action = subgrp.getAction();
+ var action = subgrp.getAction();
pdpType2action.compute(subgrp.getPdpType(), (pdpType, curact) -> {
if (curact != null && action == Action.PATCH) {
- BeanValidationResult subResult = new BeanValidationResult(pdpType, pdpType);
+ var subResult = new BeanValidationResult(pdpType, pdpType);
subResult.addResult("action", action, ValidationStatus.INVALID,
"incompatible with previous action: " + curact);
- BeanValidationResult subResult2 = new BeanValidationResult(SUBGROUP_FIELD, subgrp);
+ var subResult2 = new BeanValidationResult(SUBGROUP_FIELD, subgrp);
subResult2.addResult(subResult);
result.addResult(subResult2);
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroups.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroups.java
index 0d810d210..dfdf3ac19 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroups.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroups.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -49,7 +49,7 @@ public class DeploymentGroups {
* @return the validation result
*/
public ValidationResult validatePapRest() {
- BeanValidationResult result = new BeanValidationResult(GROUPS_FIELD, this);
+ var result = new BeanValidationResult(GROUPS_FIELD, this);
result.validateNotNullList(GROUPS_FIELD, groups, DeploymentGroup::validatePapRest);
if (!result.isValid()) {
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
index 35443a291..361f7daa9 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -72,7 +72,7 @@ public class DeploymentSubGroup {
* @return the validation result
*/
public ValidationResult validatePapRest() {
- BeanValidationResult result = new BeanValidationResult("group", this);
+ var result = new BeanValidationResult("group", this);
result.validateNotNull("pdpType", pdpType);
result.validateNotNull("action", action);
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
index 6d7607924..845b7ad76 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
@@ -84,7 +84,7 @@ public class PdpGroup implements PfNameVersion, Comparable<PdpGroup> {
* @return the validation result
*/
public ValidationResult validatePapRest(boolean updateGroupFlow) {
- BeanValidationResult result = new BeanValidationResult("group", this);
+ var result = new BeanValidationResult("group", this);
/*
* Don't care about state, because we override it. Ok if description is null.
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java
index a7ceaa9a5..ad64deb21 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2021 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.
@@ -143,7 +143,7 @@ public class PdpGroupFilter implements PfObjectFilter<PdpGroup> {
for (ToscaConceptIdentifier supportedPolicyType : supportedPolicyTypes) {
String supName = supportedPolicyType.getName();
if (supName.endsWith(".*")) {
- String substr = supName.substring(0, supName.length() - 1);
+ var substr = supName.substring(0, supName.length() - 1);
if (typeFilter.stream().anyMatch(type -> type.getName().startsWith(substr))) {
return true;
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
index 0e9554d03..3cf8b9b05 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
@@ -80,7 +80,7 @@ public class PdpSubGroup {
* @return the validation result
*/
public ValidationResult validatePapRest(boolean updateGroupFlow) {
- BeanValidationResult result = new BeanValidationResult("group", this);
+ var result = new BeanValidationResult("group", this);
result.validateNotNull("pdpType", pdpType);
// When doing PdpGroup Update operation, supported policy types and policies doesn't have to be validated.
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
index 87a52fe38..daa327d9f 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
@@ -131,7 +131,7 @@ public class JpaPdp extends PfConcept implements PfAuthorative<Pdp>, Serializabl
@Override
public Pdp toAuthorative() {
- Pdp pdp = new Pdp();
+ var pdp = new Pdp();
pdp.setInstanceId(key.getLocalName());
pdp.setPdpState(pdpState);
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java
index c91bf9a62..c94cfdd91 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java
@@ -153,7 +153,7 @@ public class JpaPdpGroup extends PfConcept implements PfAuthorative<PdpGroup> {
@Override
public PdpGroup toAuthorative() {
- PdpGroup pdpGroup = new PdpGroup();
+ var pdpGroup = new PdpGroup();
pdpGroup.setName(getKey().getName());
pdpGroup.setVersion(getKey().getVersion());
@@ -184,7 +184,7 @@ public class JpaPdpGroup extends PfConcept implements PfAuthorative<PdpGroup> {
this.pdpSubGroups = new ArrayList<>();
for (PdpSubGroup pdpSubgroup : pdpGroup.getPdpSubgroups()) {
- JpaPdpSubGroup jpaPdpSubGroup = new JpaPdpSubGroup();
+ var jpaPdpSubGroup = new JpaPdpSubGroup();
jpaPdpSubGroup.setKey(new PfReferenceKey(getKey(), pdpSubgroup.getPdpType()));
jpaPdpSubGroup.fromAuthorative(pdpSubgroup);
this.pdpSubGroups.add(jpaPdpSubGroup);
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java
index 71ec6b8a9..536bb76a2 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java
@@ -154,10 +154,8 @@ public class JpaPdpPolicyStatus extends PfConcept implements PfAuthorative<PdpPo
@Override
public PdpPolicyStatus toAuthorative() {
PfConceptKey policyKey = key.getParentConceptKey();
- ToscaConceptIdentifier policyIdent = new ToscaConceptIdentifier(policyKey.getName(), policyKey.getVersion());
-
- ToscaConceptIdentifier policyTypeIdent =
- new ToscaConceptIdentifier(policyType.getName(), policyType.getVersion());
+ var policyIdent = new ToscaConceptIdentifier(policyKey.getName(), policyKey.getVersion());
+ var policyTypeIdent = new ToscaConceptIdentifier(policyType.getName(), policyType.getVersion());
// @formatter:off
return PdpPolicyStatus.builder()
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java
index ae859325d..a62eaa304 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java
@@ -3,7 +3,7 @@
* ONAP Policy Model
* ================================================================================
* Copyright (C) 2019-2021 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.
@@ -177,7 +177,7 @@ public class JpaPdpStatistics extends PfConcept implements PfAuthorative<PdpStat
@Override
public PdpStatistics toAuthorative() {
- PdpStatistics pdpStatistics = new PdpStatistics();
+ var pdpStatistics = new PdpStatistics();
pdpStatistics.setPdpInstanceId(key.getName());
pdpStatistics.setGeneratedId(key.getGeneratedId());
pdpStatistics.setTimeStamp(timeStamp.toInstant());
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
index 4c0fe7630..1d49a9b8b 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
@@ -172,20 +172,20 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative<PdpSubGro
@Override
public PdpSubGroup toAuthorative() {
- PdpSubGroup pdpSubgroup = new PdpSubGroup();
+ var pdpSubgroup = new PdpSubGroup();
pdpSubgroup.setPdpType(getKey().getLocalName());
pdpSubgroup.setSupportedPolicyTypes(new ArrayList<>());
for (PfSearchableKey supportedPolicyTypeKey : supportedPolicyTypes) {
- ToscaConceptIdentifier supportedPolicyTypeIdent = new ToscaConceptIdentifier(
+ var supportedPolicyTypeIdent = new ToscaConceptIdentifier(
supportedPolicyTypeKey.getName(), supportedPolicyTypeKey.getVersion());
pdpSubgroup.getSupportedPolicyTypes().add(supportedPolicyTypeIdent);
}
pdpSubgroup.setPolicies(new ArrayList<>());
for (PfConceptKey policyKey : policies) {
- ToscaConceptIdentifier toscaPolicyIdentifier = new ToscaConceptIdentifier();
+ var toscaPolicyIdentifier = new ToscaConceptIdentifier();
toscaPolicyIdentifier.setName(policyKey.getName());
toscaPolicyIdentifier.setVersion(policyKey.getVersion());
pdpSubgroup.getPolicies().add(toscaPolicyIdentifier);
@@ -233,7 +233,7 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative<PdpSubGro
this.pdpInstances = new ArrayList<>();
if (pdpSubgroup.getPdpInstances() != null) {
for (Pdp pdp : pdpSubgroup.getPdpInstances()) {
- JpaPdp jpaPdp = new JpaPdp();
+ var jpaPdp = new JpaPdp();
jpaPdp.setKey(new PfReferenceKey(getKey(), pdp.getInstanceId()));
jpaPdp.fromAuthorative(pdp);
this.pdpInstances.add(jpaPdp);
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java
index 7d59166e2..4ffb1e40e 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java
@@ -95,7 +95,7 @@ public class PdpProvider {
throws PfModelException {
for (PdpGroup pdpGroup : pdpGroups) {
- JpaPdpGroup jpaPdpGroup = new JpaPdpGroup();
+ var jpaPdpGroup = new JpaPdpGroup();
jpaPdpGroup.fromAuthorative(pdpGroup);
BeanValidationResult validationResult = jpaPdpGroup.validate("PDP group");
@@ -110,8 +110,7 @@ public class PdpProvider {
List<PdpGroup> returnPdpGroups = new ArrayList<>();
for (PdpGroup pdpGroup : pdpGroups) {
- JpaPdpGroup jpaPdpGroup =
- dao.get(JpaPdpGroup.class, new PfConceptKey(pdpGroup.getName(), PfKey.NULL_KEY_VERSION));
+ var jpaPdpGroup = dao.get(JpaPdpGroup.class, new PfConceptKey(pdpGroup.getName(), PfKey.NULL_KEY_VERSION));
returnPdpGroups.add(jpaPdpGroup.toAuthorative());
}
@@ -130,7 +129,7 @@ public class PdpProvider {
throws PfModelException {
for (PdpGroup pdpGroup : pdpGroups) {
- JpaPdpGroup jpaPdpGroup = new JpaPdpGroup();
+ var jpaPdpGroup = new JpaPdpGroup();
jpaPdpGroup.fromAuthorative(pdpGroup);
BeanValidationResult validationResult = jpaPdpGroup.validate("PDP group");
@@ -145,7 +144,7 @@ public class PdpProvider {
List<PdpGroup> returnPdpGroups = new ArrayList<>();
for (PdpGroup pdpGroup : pdpGroups) {
- JpaPdpGroup jpaPdpGroup =
+ var jpaPdpGroup =
dao.get(JpaPdpGroup.class, new PfConceptKey(pdpGroup.getName(), PfKey.NULL_KEY_VERSION));
returnPdpGroups.add(jpaPdpGroup.toAuthorative());
}
@@ -164,9 +163,9 @@ public class PdpProvider {
public void updatePdpSubGroup(@NonNull final PfDao dao, @NonNull final String pdpGroupName,
@NonNull final PdpSubGroup pdpSubGroup) throws PfModelException {
- final PfReferenceKey subGroupKey =
+ final var subGroupKey =
new PfReferenceKey(pdpGroupName, PfKey.NULL_KEY_VERSION, pdpSubGroup.getPdpType());
- final JpaPdpSubGroup jpaPdpSubgroup = new JpaPdpSubGroup(subGroupKey);
+ final var jpaPdpSubgroup = new JpaPdpSubGroup(subGroupKey);
jpaPdpSubgroup.fromAuthorative(pdpSubGroup);
BeanValidationResult validationResult = jpaPdpSubgroup.validate("PDP sub group");
@@ -189,9 +188,9 @@ public class PdpProvider {
public void updatePdp(@NonNull final PfDao dao, @NonNull final String pdpGroupName,
@NonNull final String pdpSubGroup, @NonNull final Pdp pdp) {
- final PfReferenceKey pdpKey =
+ final var pdpKey =
new PfReferenceKey(pdpGroupName, PfKey.NULL_KEY_VERSION, pdpSubGroup, pdp.getInstanceId());
- final JpaPdp jpaPdp = new JpaPdp(pdpKey);
+ final var jpaPdp = new JpaPdp(pdpKey);
jpaPdp.fromAuthorative(pdp);
BeanValidationResult validationResult = jpaPdp.validate("PDP");
@@ -212,7 +211,7 @@ public class PdpProvider {
*/
public PdpGroup deletePdpGroup(@NonNull final PfDao dao, @NonNull final String name) {
- PfConceptKey pdpGroupKey = new PfConceptKey(name, PfKey.NULL_KEY_VERSION);
+ var pdpGroupKey = new PfConceptKey(name, PfKey.NULL_KEY_VERSION);
JpaPdpGroup jpaDeletePdpGroup = dao.get(JpaPdpGroup.class, pdpGroupKey);
@@ -341,9 +340,9 @@ public class PdpProvider {
List<JpaPdpPolicyStatus> jpas = objs.stream().map(JpaPdpPolicyStatus::new).collect(Collectors.toList());
// validate the objects
- BeanValidationResult result = new BeanValidationResult(fieldName, jpas);
+ var result = new BeanValidationResult(fieldName, jpas);
- int count = 0;
+ var count = 0;
for (JpaPdpPolicyStatus jpa: jpas) {
result.addResult(jpa.validate(String.valueOf(count++)));
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProvider.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProvider.java
index ece09b088..205761bf5 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProvider.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProvider.java
@@ -3,7 +3,7 @@
* ONAP Policy Model
* ================================================================================
* Copyright (C) 2019-2021 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.
@@ -60,7 +60,6 @@ public class PdpStatisticsProvider {
*/
public List<PdpStatistics> getPdpStatistics(@NonNull final PfDao dao, final String name, final Instant timeStamp)
throws PfModelException {
- List<PdpStatistics> pdpStatistics = new ArrayList<>();
if (name != null && timeStamp != null) {
return asPdpStatisticsList(dao.getByTimestamp(JpaPdpStatistics.class,
new PfGeneratedIdKey(name, PfKey.NULL_KEY_VERSION), timeStamp));
@@ -130,7 +129,7 @@ public class PdpStatisticsProvider {
public List<PdpStatistics> createPdpStatistics(@NonNull final PfDao dao,
@NonNull final List<PdpStatistics> pdpStatisticsList) throws PfModelException {
for (PdpStatistics pdpStatistics : pdpStatisticsList) {
- JpaPdpStatistics jpaPdpStatistics = new JpaPdpStatistics();
+ var jpaPdpStatistics = new JpaPdpStatistics();
jpaPdpStatistics.fromAuthorative(pdpStatistics);
BeanValidationResult validationResult = jpaPdpStatistics.validate("pdp statistics");
if (!validationResult.isValid()) {
@@ -145,7 +144,7 @@ public class PdpStatisticsProvider {
List<PdpStatistics> pdpStatistics = new ArrayList<>(pdpStatisticsList.size());
for (PdpStatistics pdpStatisticsItem : pdpStatisticsList) {
- JpaPdpStatistics jpaPdpStatistics =
+ var jpaPdpStatistics =
dao.get(JpaPdpStatistics.class, new PfGeneratedIdKey(pdpStatisticsItem.getPdpInstanceId(),
PfKey.NULL_KEY_VERSION, pdpStatisticsItem.getGeneratedId()));
pdpStatistics.add(jpaPdpStatistics.toAuthorative());
@@ -165,7 +164,7 @@ public class PdpStatisticsProvider {
@NonNull final List<PdpStatistics> pdpStatisticsList) throws PfModelException {
for (PdpStatistics pdpStatistics : pdpStatisticsList) {
- JpaPdpStatistics jpaPdpStatistics = new JpaPdpStatistics();
+ var jpaPdpStatistics = new JpaPdpStatistics();
jpaPdpStatistics.fromAuthorative(pdpStatistics);
BeanValidationResult validationResult = jpaPdpStatistics.validate("pdp statistics");
@@ -180,7 +179,7 @@ public class PdpStatisticsProvider {
List<PdpStatistics> pdpStatistics = new ArrayList<>(pdpStatisticsList.size());
for (PdpStatistics pdpStatisticsItem : pdpStatisticsList) {
- JpaPdpStatistics jpaPdpStatistics =
+ var jpaPdpStatistics =
dao.get(JpaPdpStatistics.class, new PfGeneratedIdKey(pdpStatisticsItem.getPdpInstanceId(),
PfKey.NULL_KEY_VERSION, pdpStatisticsItem.getGeneratedId()));
pdpStatistics.add(jpaPdpStatistics.toAuthorative());
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java
index a0c5ce678..dc0a1f62e 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java
@@ -69,17 +69,17 @@ public abstract class AbstractModelsProvider implements Closeable {
parameters.getPersistenceUnit());
if (pfDao != null) {
- String errorMessage = "provider is already initialized";
+ var errorMessage = "provider is already initialized";
throw new PfModelException(Response.Status.NOT_ACCEPTABLE, errorMessage);
}
// Parameters for the DAO
- final DaoParameters daoParameters = new DaoParameters();
+ final var daoParameters = new DaoParameters();
daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit(parameters.getPersistenceUnit());
// @formatter:off
- Properties jdbcProperties = new Properties();
+ var jdbcProperties = new Properties();
jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, parameters.getDatabaseDriver());
jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL, parameters.getDatabaseUrl());
jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER, parameters.getDatabaseUser());
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
index 1839604aa..a90dc895c 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
@@ -146,7 +146,7 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp
throws PfModelException {
assertInitialized();
- ToscaConceptIdentifier policyTypeIdentifier = new ToscaConceptIdentifier(name, version);
+ var policyTypeIdentifier = new ToscaConceptIdentifier(name, version);
assertPolicyTypeNotSupportedInPdpGroup(policyTypeIdentifier);
return new AuthorativeToscaProvider().deletePolicyType(getPfDao(), name, version);
@@ -197,7 +197,7 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp
throws PfModelException {
assertInitialized();
- ToscaConceptIdentifier policyIdentifier = new ToscaConceptIdentifier(name, version);
+ var policyIdentifier = new ToscaConceptIdentifier(name, version);
assertPolicyNotDeployedInPdpGroup(policyIdentifier);
return new AuthorativeToscaProvider().deletePolicy(getPfDao(), name, version);
@@ -314,7 +314,7 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp
*/
private void assertInitialized() {
if (getPfDao() == null) {
- String errorMessage = "policy models provider is not initilaized";
+ var errorMessage = "policy models provider is not initilaized";
throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage);
}
}
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
index 07617aad9..f47f4d464 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
@@ -274,7 +274,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
* @return the ToscaServiceTemplate with the dummy response
*/
protected ToscaServiceTemplate getDummyResponse(final String fileName) {
- StandardCoder standardCoder = new StandardCoder();
+ var standardCoder = new StandardCoder();
ToscaServiceTemplate serviceTemplate;
try {
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
index a1102cb51..9e8ba0bbc 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
@@ -412,7 +412,7 @@ public class DatabasePolicyModelsProviderTest {
List<PdpStatistics> statisticsArrayList = makePdpStatisticsList();
- assertThat(databaseProvider.getPdpStatistics(null, null)).hasSize(0);
+ assertThat(databaseProvider.getPdpStatistics(null, null)).isEmpty();
assertThat(databaseProvider.createPdpStatistics(statisticsArrayList)).hasSize(1);
assertThat(databaseProvider.updatePdpStatistics(statisticsArrayList)).hasSize(1);
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java
index 9033c8fa0..a24341458 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java
@@ -57,7 +57,7 @@ public class ToscaConceptIdentifier extends ToscaNameVersion
* @return the validation result
*/
public ValidationResult validatePapRest() {
- BeanValidationResult result = new BeanValidationResult("identifier", this);
+ var result = new BeanValidationResult("identifier", this);
result.validateNotNull("name", getName());
result.validateNotNull("version", getVersion());
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java
index c43aadf0f..8171b7d78 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2021 Nordix Foundation.
- * Modifications Copyright (C) 2019 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.
@@ -243,7 +243,7 @@ public class AuthorativeToscaProvider {
synchronized (providerLockObject) {
LOGGER.debug("->getFilteredPolicyTypes: filter={}", filter);
- SimpleToscaProvider simpleToscaProvider = new SimpleToscaProvider();
+ var simpleToscaProvider = new SimpleToscaProvider();
final JpaToscaServiceTemplate dbServiceTemplate = simpleToscaProvider.getPolicyTypes(dao, null, null);
@@ -255,7 +255,7 @@ public class AuthorativeToscaProvider {
"policy types for filter " + filter.toString() + " do not exist");
}
- JpaToscaServiceTemplate filteredServiceTemplate = new JpaToscaServiceTemplate();
+ var filteredServiceTemplate = new JpaToscaServiceTemplate();
for (ToscaPolicyType policyType : filteredPolicyTypes) {
JpaToscaServiceTemplate cascadedServiceTemplate = simpleToscaProvider
@@ -430,7 +430,7 @@ public class AuthorativeToscaProvider {
String version =
ToscaTypedEntityFilter.LATEST_VERSION.equals(filter.getVersion()) ? null : filter.getVersion();
- SimpleToscaProvider simpleToscaProvider = new SimpleToscaProvider();
+ var simpleToscaProvider = new SimpleToscaProvider();
final JpaToscaServiceTemplate dbServiceTemplate =
simpleToscaProvider.getPolicies(dao, filter.getName(), version);
@@ -443,7 +443,7 @@ public class AuthorativeToscaProvider {
"policies for filter " + filter.toString() + " do not exist");
}
- JpaToscaServiceTemplate filteredServiceTemplate = new JpaToscaServiceTemplate();
+ var filteredServiceTemplate = new JpaToscaServiceTemplate();
for (ToscaPolicy policy : filteredPolicies) {
JpaToscaServiceTemplate cascadedServiceTemplate = simpleToscaProvider
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 76508dabe..3e0ec281b 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
@@ -104,7 +104,7 @@ public class JpaToscaCapabilityAssignment extends JpaToscaWithTypeAndStringPrope
@Override
public ToscaCapabilityAssignment toAuthorative() {
- ToscaCapabilityAssignment toscaCapabilityAssignment = new ToscaCapabilityAssignment();
+ var toscaCapabilityAssignment = new ToscaCapabilityAssignment();
super.setToscaEntity(toscaCapabilityAssignment);
super.toAuthorative();
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java
index 73546f681..e8d16a705 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.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.
@@ -70,7 +71,7 @@ public class JpaToscaConstraintLogical extends JpaToscaConstraint {
@Override
public ToscaConstraint toAuthorative() {
- ToscaConstraint toscaConstraint = new ToscaConstraint();
+ var toscaConstraint = new ToscaConstraint();
if (operation == null) {
return null;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java
index 9941bc9fd..b5c2d10e5 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 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");
@@ -68,7 +68,7 @@ public class JpaToscaConstraintValidValues extends JpaToscaConstraint {
@Override
public ToscaConstraint toAuthorative() {
- ToscaConstraint toscaConstraint = new ToscaConstraint();
+ var toscaConstraint = new ToscaConstraint();
toscaConstraint.setValidValues(validValues);
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 bcbf40086..c086c535a 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
@@ -90,7 +90,7 @@ public class JpaToscaDataType extends JpaToscaWithToscaProperties<ToscaDataType>
@Override
public ToscaDataType toAuthorative() {
- ToscaDataType toscaDataType = new ToscaDataType();
+ var toscaDataType = new ToscaDataType();
super.setToscaEntity(toscaDataType);
super.toAuthorative();
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 f6cfc1258..bd1dfd4d5 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
@@ -126,7 +126,7 @@ public class JpaToscaNodeTemplate extends JpaToscaWithTypeAndStringProperties<To
@Override
public ToscaNodeTemplate toAuthorative() {
- ToscaNodeTemplate toscaNodeTemplate = new ToscaNodeTemplate();
+ var toscaNodeTemplate = new ToscaNodeTemplate();
super.setToscaEntity(toscaNodeTemplate);
super.toAuthorative();
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 ee0f68e0a..512abb75b 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
@@ -95,7 +95,7 @@ public class JpaToscaNodeType extends JpaToscaWithToscaProperties<ToscaNodeType>
@Override
public ToscaNodeType toAuthorative() {
- ToscaNodeType toscaNodeType = new ToscaNodeType();
+ var toscaNodeType = new ToscaNodeType();
super.setToscaEntity(toscaNodeType);
super.toAuthorative();
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java
index 0348bb1d4..9b023dcba 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.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.
@@ -116,7 +116,7 @@ public class JpaToscaParameter extends PfConcept implements PfAuthorative<ToscaP
@Override
public ToscaParameter toAuthorative() {
- ToscaParameter toscaParameter = new ToscaParameter();
+ var toscaParameter = new ToscaParameter();
toscaParameter.setName(key.getLocalName());
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 b33205c43..76861d294 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
@@ -117,7 +117,7 @@ public class JpaToscaPolicy extends JpaToscaWithTypeAndStringProperties<ToscaPol
@Override
public ToscaPolicy toAuthorative() {
- ToscaPolicy toscaPolicy = new ToscaPolicy();
+ var toscaPolicy = new ToscaPolicy();
super.setToscaEntity(toscaPolicy);
super.toAuthorative();
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 8e40384d8..f6c1a7c4e 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
@@ -95,7 +95,7 @@ public class JpaToscaPolicyType extends JpaToscaWithToscaProperties<ToscaPolicyT
@Override
public ToscaPolicyType toAuthorative() {
- ToscaPolicyType toscaPolicyType = new ToscaPolicyType();
+ var toscaPolicyType = new ToscaPolicyType();
super.setToscaEntity(toscaPolicyType);
super.toAuthorative();
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 cd2961637..f49c0ea81 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
@@ -158,7 +158,7 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative<ToscaPr
@Override
public ToscaProperty toAuthorative() {
- ToscaProperty toscaProperty = new ToscaProperty();
+ var toscaProperty = new ToscaProperty();
toscaProperty.setName(key.getLocalName());
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 20b6aff96..f2cf14cb7 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
@@ -112,7 +112,7 @@ public class JpaToscaRequirement extends JpaToscaWithTypeAndStringProperties<Tos
@Override
public ToscaRequirement toAuthorative() {
- ToscaRequirement toscaRequirement = new ToscaRequirement();
+ var toscaRequirement = new ToscaRequirement();
super.setToscaEntity(toscaRequirement);
super.toAuthorative();
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 f7619c951..75941b28f 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
@@ -101,7 +101,7 @@ public class JpaToscaSchemaDefinition extends Validated
@Override
public ToscaSchemaDefinition toAuthorative() {
- ToscaSchemaDefinition toscaEntrySchema = new ToscaSchemaDefinition();
+ var toscaEntrySchema = new ToscaSchemaDefinition();
toscaEntrySchema.setType(type.getName());
toscaEntrySchema.setTypeVersion(type.getVersion());
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
index 0d9060d33..902437447 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
@@ -181,7 +181,7 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType<ToscaServiceTemp
@Override
public ToscaServiceTemplate toAuthorative() {
- final ToscaServiceTemplate toscaServiceTemplate = new ToscaServiceTemplate();
+ final var toscaServiceTemplate = new ToscaServiceTemplate();
super.setToscaEntity(toscaServiceTemplate);
super.toAuthorative();
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 b00b14a9e..af6f512dd 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
@@ -142,7 +142,7 @@ public class JpaToscaTopologyTemplate extends PfConcept implements PfAuthorative
@Override
public ToscaTopologyTemplate toAuthorative() {
- final ToscaTopologyTemplate toscaTopologyTemplate = new ToscaTopologyTemplate();
+ final var toscaTopologyTemplate = new ToscaTopologyTemplate();
toscaTopologyTemplate.setDescription(description);
@@ -178,7 +178,7 @@ public class JpaToscaTopologyTemplate extends PfConcept implements PfAuthorative
if (toscaTopologyTemplate.getInputs() != null) {
inputs = new LinkedHashMap<>();
for (Map.Entry<String, ToscaParameter> toscaInputEntry : toscaTopologyTemplate.getInputs().entrySet()) {
- JpaToscaParameter jpaInput = new JpaToscaParameter(toscaInputEntry.getValue());
+ var jpaInput = new JpaToscaParameter(toscaInputEntry.getValue());
jpaInput.setKey(new PfReferenceKey(getKey(), toscaInputEntry.getKey()));
inputs.put(toscaInputEntry.getKey(), jpaInput);
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithToscaProperties.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithToscaProperties.java
index 33e4e86b4..510287581 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithToscaProperties.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithToscaProperties.java
@@ -107,7 +107,7 @@ public abstract class JpaToscaWithToscaProperties<T extends ToscaWithToscaProper
if (authorativeConcept.getProperties() != null) {
properties = new LinkedHashMap<>();
for (Entry<String, ToscaProperty> toscaPropertyEntry : authorativeConcept.getProperties().entrySet()) {
- JpaToscaProperty jpaProperty = new JpaToscaProperty(toscaPropertyEntry.getValue());
+ var jpaProperty = new JpaToscaProperty(toscaPropertyEntry.getValue());
jpaProperty.setKey(new PfReferenceKey(getKey(), toscaPropertyEntry.getKey()));
properties.put(toscaPropertyEntry.getKey(), jpaProperty);
}
@@ -116,7 +116,7 @@ public abstract class JpaToscaWithToscaProperties<T extends ToscaWithToscaProper
@Override
public T toAuthorative() {
- T tosca = super.toAuthorative();
+ var tosca = super.toAuthorative();
tosca.setProperties(PfUtils.mapMap(properties, JpaToscaProperty::toAuthorative));
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java
index 1ba63cad5..55acc0653 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java
@@ -117,7 +117,7 @@ public abstract class JpaToscaWithTypeAndStringProperties<T extends ToscaWithTyp
@Override
public T toAuthorative() {
- T tosca = super.toAuthorative();
+ var tosca = super.toAuthorative();
tosca.setType(type.getName());
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java
index 8fb4a7711..862108b15 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-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.
@@ -175,7 +175,7 @@ public class SimpleToscaProvider {
public JpaToscaServiceTemplate getCascadedDataTypes(@NonNull final JpaToscaServiceTemplate dbServiceTemplate,
final String name, final String version) throws PfModelException {
- JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate(dbServiceTemplate);
+ var serviceTemplate = new JpaToscaServiceTemplate(dbServiceTemplate);
serviceTemplate.setPolicyTypes(null);
serviceTemplate.setTopologyTemplate(null);
@@ -239,13 +239,13 @@ public class SimpleToscaProvider {
}
// Return the created data types
- JpaToscaDataTypes returnDataTypes = new JpaToscaDataTypes();
+ var returnDataTypes = new JpaToscaDataTypes();
for (PfConceptKey dataTypeKey : serviceTemplate.getDataTypes().getConceptMap().keySet()) {
returnDataTypes.getConceptMap().put(dataTypeKey, dao.get(JpaToscaDataType.class, dataTypeKey));
}
- JpaToscaServiceTemplate returnServiceTemplate = new JpaToscaServiceTemplate();
+ var returnServiceTemplate = new JpaToscaServiceTemplate();
returnServiceTemplate.setDataTypes(returnDataTypes);
LOGGER.debug("<-updateDataTypes: returnServiceTempalate={}", returnServiceTemplate);
@@ -296,7 +296,7 @@ public class SimpleToscaProvider {
new SimpleToscaServiceTemplateProvider().write(dao, serviceTemplate);
dao.delete(dataType4Deletion);
- JpaToscaServiceTemplate deletedServiceTemplate = new JpaToscaServiceTemplate();
+ var deletedServiceTemplate = new JpaToscaServiceTemplate();
deletedServiceTemplate.setDataTypes(new JpaToscaDataTypes());
deletedServiceTemplate.getDataTypes().getConceptMap().put(dataTypeKey, dataType4Deletion);
@@ -342,7 +342,7 @@ public class SimpleToscaProvider {
public JpaToscaServiceTemplate getCascadedPolicyTypes(final JpaToscaServiceTemplate dbServiceTemplate,
final String name, final String version) throws PfModelException {
- JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate(dbServiceTemplate);
+ var serviceTemplate = new JpaToscaServiceTemplate(dbServiceTemplate);
serviceTemplate.setDataTypes(null);
serviceTemplate.setTopologyTemplate(null);
@@ -354,7 +354,7 @@ public class SimpleToscaProvider {
"policy types for " + name + ":" + version + DO_NOT_EXIST);
}
- JpaToscaServiceTemplate dataTypeServiceTemplate = new JpaToscaServiceTemplate(serviceTemplate);
+ var dataTypeServiceTemplate = new JpaToscaServiceTemplate(serviceTemplate);
dataTypeServiceTemplate.setPolicyTypes(null);
for (JpaToscaPolicyType policyType : serviceTemplate.getPolicyTypes().getConceptMap().values()) {
@@ -417,13 +417,13 @@ public class SimpleToscaProvider {
}
// Return the created policy types
- JpaToscaPolicyTypes returnPolicyTypes = new JpaToscaPolicyTypes();
+ var returnPolicyTypes = new JpaToscaPolicyTypes();
for (PfConceptKey policyTypeKey : serviceTemplate.getPolicyTypes().getConceptMap().keySet()) {
returnPolicyTypes.getConceptMap().put(policyTypeKey, dao.get(JpaToscaPolicyType.class, policyTypeKey));
}
- JpaToscaServiceTemplate returnServiceTemplate = new JpaToscaServiceTemplate();
+ var returnServiceTemplate = new JpaToscaServiceTemplate();
returnServiceTemplate.setPolicyTypes(returnPolicyTypes);
LOGGER.debug("<-updatePolicyTypes: returnServiceTempalate={}", returnServiceTemplate);
@@ -455,7 +455,7 @@ public class SimpleToscaProvider {
POLICY_TYPE + policyTypeKey.getId() + NOT_FOUND);
}
- BeanValidationResult result = new BeanValidationResult("policy types", serviceTemplate);
+ var result = new BeanValidationResult("policy types", serviceTemplate);
for (JpaToscaPolicyType policyType : serviceTemplate.getPolicyTypes().getAll(null)) {
Collection<JpaToscaEntityType<ToscaEntity>> ancestorList = ToscaUtils
@@ -480,7 +480,7 @@ public class SimpleToscaProvider {
new SimpleToscaServiceTemplateProvider().write(dao, serviceTemplate);
dao.delete(policyType4Deletion);
- JpaToscaServiceTemplate deletedServiceTemplate = new JpaToscaServiceTemplate();
+ var deletedServiceTemplate = new JpaToscaServiceTemplate();
deletedServiceTemplate.setPolicyTypes(new JpaToscaPolicyTypes());
deletedServiceTemplate.getPolicyTypes().getConceptMap().put(policyTypeKey, policyType4Deletion);
@@ -526,7 +526,7 @@ public class SimpleToscaProvider {
public JpaToscaServiceTemplate getCascadedPolicies(final JpaToscaServiceTemplate dbServiceTemplate,
final String name, final String version) throws PfModelException {
- JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate(dbServiceTemplate);
+ var serviceTemplate = new JpaToscaServiceTemplate(dbServiceTemplate);
serviceTemplate.setDataTypes(new JpaToscaDataTypes());
serviceTemplate.setPolicyTypes(new JpaToscaPolicyTypes());
@@ -537,7 +537,7 @@ public class SimpleToscaProvider {
"policies for " + name + ":" + version + DO_NOT_EXIST);
}
- JpaToscaServiceTemplate returnServiceTemplate = new JpaToscaServiceTemplate(serviceTemplate);
+ var returnServiceTemplate = new JpaToscaServiceTemplate(serviceTemplate);
returnServiceTemplate.getTopologyTemplate().setPolicies(new JpaToscaPolicies());
for (JpaToscaPolicy policy : serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().values()) {
@@ -592,7 +592,7 @@ public class SimpleToscaProvider {
}
// Return the created policy types
- JpaToscaPolicies returnPolicies = new JpaToscaPolicies();
+ var returnPolicies = new JpaToscaPolicies();
returnPolicies.setKey(serviceTemplate.getTopologyTemplate().getPolicies().getKey());
for (PfConceptKey policyKey : serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().keySet()) {
@@ -632,7 +632,7 @@ public class SimpleToscaProvider {
new SimpleToscaServiceTemplateProvider().write(dao, serviceTemplate);
dao.delete(policy4Deletion);
- JpaToscaServiceTemplate deletedServiceTemplate = new JpaToscaServiceTemplate();
+ var deletedServiceTemplate = new JpaToscaServiceTemplate();
deletedServiceTemplate.setTopologyTemplate(new JpaToscaTopologyTemplate());
deletedServiceTemplate.getTopologyTemplate().setPolicies(new JpaToscaPolicies());
deletedServiceTemplate.getTopologyTemplate().getPolicies().getConceptMap().put(policyKey, policy4Deletion);
@@ -685,7 +685,7 @@ public class SimpleToscaProvider {
}
// Create a filter to get the latest version of the policy type
- PfConceptFilter pfConceptFilter = PfConceptFilter.builder().version(PfConceptFilter.LATEST_VERSION).build();
+ var pfConceptFilter = PfConceptFilter.builder().version(PfConceptFilter.LATEST_VERSION).build();
// FIlter the returned policy type list
List<PfConcept> policyTypeKeyList = new ArrayList<>(jpaPolicyTypeList);
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java
index fe5299337..12e3a9d5a 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
- * Modifications Copyright (C) 2020 AT&T
+ * 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.
@@ -57,7 +57,7 @@ public class ToscaServiceTemplateUtils {
public static JpaToscaServiceTemplate addFragment(@NonNull final JpaToscaServiceTemplate originalTemplate,
@NonNull final JpaToscaServiceTemplate fragmentTemplate) {
- BeanValidationResult result = new BeanValidationResult("incoming fragment", fragmentTemplate);
+ var result = new BeanValidationResult("incoming fragment", fragmentTemplate);
if (originalTemplate.compareToWithoutEntities(fragmentTemplate) != 0) {
Validated.addResult(result, "service template",
@@ -65,7 +65,7 @@ public class ToscaServiceTemplateUtils {
"does not equal existing service template");
}
- JpaToscaServiceTemplate compositeTemplate = new JpaToscaServiceTemplate(originalTemplate);
+ var compositeTemplate = new JpaToscaServiceTemplate(originalTemplate);
compositeTemplate.setDataTypes(
addFragmentEntitites(compositeTemplate.getDataTypes(), fragmentTemplate.getDataTypes(), result));
@@ -123,7 +123,7 @@ public class ToscaServiceTemplateUtils {
return compositeContainer;
}
- BeanValidationResult result2 = new BeanValidationResult("incoming fragment", fragmentContainer);
+ var result2 = new BeanValidationResult("incoming fragment", fragmentContainer);
for (Entry<PfConceptKey, ? extends JpaToscaEntityType<? extends ToscaEntity>> fragmentEntry : fragmentContainer
.getConceptMap().entrySet()) {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java
index 2fa2a557a..450b589c5 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java
@@ -29,7 +29,6 @@ import javax.ws.rs.core.Response;
import lombok.NonNull;
import org.apache.commons.collections4.CollectionUtils;
import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.parameters.ObjectValidationResult;
import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.models.base.PfConcept;
import org.onap.policy.models.base.PfConceptContainer;
@@ -259,7 +258,7 @@ public final class ToscaUtils {
@NonNull final PfConceptContainer<? extends PfConcept, ? extends PfNameVersion> entityTypes,
final String entityName, final String entityVersion) {
- BeanValidationResult result = new BeanValidationResult("entity", entityName);
+ var result = new BeanValidationResult("entity", entityName);
@SuppressWarnings("unchecked")
Set<JpaToscaEntityType<?>> filteredEntitySet =