Fix sonars in policy models 35/121235/2
authorJim Hahn <jrh3@att.com>
Mon, 10 May 2021 15:39:27 +0000 (11:39 -0400)
committerJim Hahn <jrh3@att.com>
Mon, 10 May 2021 15:47:43 +0000 (11:47 -0400)
Fixed:
- use "var"

Issue-ID: POLICY-3094
Change-Id: Id5ea7ab049c2018744afa75a55d44e47f216d5bc
Signed-off-by: Jim Hahn <jrh3@att.com>
38 files changed:
models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroup.java
models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentGroups.java
models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java
models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java
models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpPolicyStatus.java
models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java
models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java
models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProvider.java
models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java
models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithToscaProperties.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java
models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java
models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java

index 8746c07..79e5e79 100644 (file)
@@ -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);
                 }
index 0d810d2..dfdf3ac 100644 (file)
@@ -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()) {
index 35443a2..361f7da 100644 (file)
@@ -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);
index 6d76079..845b7ad 100644 (file)
@@ -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.
index a7ceaa9..ad64deb 100644 (file)
@@ -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;
                 }
index 0e9554d..3cf8b9b 100644 (file)
@@ -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.
index 87a52fe..daa327d 100644 (file)
@@ -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);
index c91bf9a..c94cfdd 100644 (file)
@@ -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);
index 71ec6b8..536bb76 100644 (file)
@@ -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()
index ae85932..a62eaa3 100644 (file)
@@ -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());
index 4c0fe76..1d49a9b 100644 (file)
@@ -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);
index 7d59166..4ffb1e4 100644 (file)
@@ -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++)));
         }
index ece09b0..205761b 100644 (file)
@@ -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());
index a0c5ce6..dc0a1f6 100644 (file)
@@ -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());
index 1839604..a90dc89 100644 (file)
@@ -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);
         }
     }
index 07617aa..f47f4d4 100644 (file)
@@ -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 {
index a1102cb..9e8ba0b 100644 (file)
@@ -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);
     }
index 9033c8f..a243414 100644 (file)
@@ -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());
index c43aadf..8171b7d 100644 (file)
@@ -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
index 76508da..3e0ec28 100644 (file)
@@ -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();
 
index 73546f6..e8d16a7 100644 (file)
@@ -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;
index 9941bc9..b5c2d10 100644 (file)
@@ -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);
 
index bcbf400..c086c53 100644 (file)
@@ -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();
 
index f6cfc12..bd1dfd4 100644 (file)
@@ -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();
 
index ee0f68e..512abb7 100644 (file)
@@ -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();
 
index 0348bb1..9b023dc 100644 (file)
@@ -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());
 
index b33205c..76861d2 100644 (file)
@@ -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();
 
index 8e40384..f6c1a7c 100644 (file)
@@ -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();
 
index cd29616..f49c0ea 100644 (file)
@@ -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());
 
index 20b6aff..f2cf14c 100644 (file)
@@ -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();
 
index f7619c9..75941b2 100644 (file)
@@ -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());
index 0d9060d..9024374 100644 (file)
@@ -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();
index b00b14a..af6f512 100644 (file)
@@ -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);
             }
index 33e4e86..5102875 100644 (file)
@@ -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));
 
index 1ba63ca..55acc06 100644 (file)
@@ -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());
 
index 8fb4a77..862108b 100644 (file)
@@ -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);
index fe52993..12e3a9d 100644 (file)
@@ -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()) {
index 2fa2a55..450b589 100644 (file)
@@ -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 =