Fix sonar in policy/models 80/121880/4
authorRam Krishna Verma <ram_krishna.verma@bell.ca>
Fri, 11 Jun 2021 14:13:17 +0000 (10:13 -0400)
committerRam Krishna Verma <ram_krishna.verma@bell.ca>
Tue, 15 Jun 2021 15:57:10 +0000 (15:57 +0000)
use "var" for local variables

Issue-ID: POLICY-3077
Change-Id: Ia1ea62e03c016d336c9b11b07b0ea941ba905497
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
models-pap/src/main/java/org/onap/policy/models/pap/persistence/concepts/JpaPolicyAudit.java
models-pap/src/main/java/org/onap/policy/models/pap/persistence/provider/PolicyAuditProvider.java

index b31af8e..e151441 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Nordix Foundation.
+ *  Modifications Copyright (C) 2021 Bell Canada. 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 +144,7 @@ public class JpaPolicyAudit extends PfConcept implements PfAuthorative<PolicyAud
 
     @Override
     public PolicyAudit toAuthorative() {
-        ToscaConceptIdentifier policyIdent = new ToscaConceptIdentifier(key.getName(), key.getVersion());
+        var policyIdent = new ToscaConceptIdentifier(key.getName(), key.getVersion());
 
         // @formatter:off
         return PolicyAudit.builder()
index ca8f18d..432e4c8 100644 (file)
@@ -2,6 +2,7 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Nordix Foundation.
  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2021 Bell Canada. 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,9 +58,9 @@ public class PolicyAuditProvider {
     public void createAuditRecords(@NonNull PfDao dao, @NonNull final List<PolicyAudit> audits) {
         List<JpaPolicyAudit> jpaAudits = audits.stream().map(JpaPolicyAudit::new).collect(Collectors.toList());
 
-        BeanValidationResult result = new BeanValidationResult("createAuditRecords", jpaAudits);
+        var result = new BeanValidationResult("createAuditRecords", jpaAudits);
 
-        int count = 0;
+        var count = 0;
         for (JpaPolicyAudit jpaAudit : jpaAudits) {
             result.addResult(jpaAudit.validate(String.valueOf(count++)));
         }