diff options
author | Liam Fallon <liam.fallon@est.tech> | 2021-05-11 12:28:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-05-11 12:28:31 +0000 |
commit | 385e119cf90ee2ba83377115c98b3cf60f993158 (patch) | |
tree | 085f8c6952a968a8b72e2c9e82eb6f8dda25d5cd /models-tosca/src | |
parent | 957542e0c71f82f260d474d680473238451e4052 (diff) | |
parent | 6b6eb52ef3111142ba2dc9afb85cdd48dc0454ca (diff) |
Merge "Fix sonars in policy models"
Diffstat (limited to 'models-tosca/src')
21 files changed, 48 insertions, 48 deletions
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 = |