summaryrefslogtreecommitdiffstats
path: root/controlloop/common/controller-usecases/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-05-07 15:50:22 -0400
committerJim Hahn <jrh3@att.com>2021-05-07 16:04:58 -0400
commitc2cbd89fea87897b6868b036d87d97916e89734e (patch)
treeff611957eba521fabac337d8436bb0a415330430 /controlloop/common/controller-usecases/src
parent2faa81d80569ce38a014e2a2ab404b1ea9f6899e (diff)
Fix sonars in drools-apps
Fixed: - use "var" - add @Override annotation - change constructor to "protected" - use Xxx.class::isIstance Issue-ID: POLICY-3290 Change-Id: I7f0795af306ea5afb46d12a4fe0b22adcbce683a Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/controller-usecases/src')
-rw-r--r--controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java39
-rw-r--r--controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2.java4
-rw-r--r--controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/Step2.java6
3 files changed, 16 insertions, 33 deletions
diff --git a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java
index cb71f8ea0..4d2dfa303 100644
--- a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java
+++ b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java
@@ -128,16 +128,14 @@ public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> impleme
}
/*
- * This is needed to satisfy drools.
+ * This is needed to satisfy drools, thus disabling sonar.
*/
@Override
- public Deque<Step2> getSteps() {
+ public Deque<Step2> getSteps() { // NOSONAR
return super.getSteps();
}
- /**
- * Loads the preprocessor steps needed by the step that's at the front of the queue.
- */
+ @Override
public void loadPreprocessorSteps() {
super.loadPreprocessorSteps();
@@ -145,10 +143,10 @@ public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> impleme
final Step2 step = getSteps().peek();
// determine if any A&AI queries are needed
- boolean needCq = false;
- boolean needPnf = false;
- boolean needTenant = false;
- boolean needTargetEntity = false;
+ var needCq = false;
+ var needPnf = false;
+ var needTenant = false;
+ var needTargetEntity = false;
for (String propName : step.getPropertyNames()) {
needCq = needCq || CQ_PROPERTIES.contains(propName);
@@ -199,12 +197,7 @@ public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> impleme
}
}
- /**
- * Determines if the TOSCA should be aborted due to the given outcome.
- *
- * @param outcome outcome to examine
- * @return {@code true} if the TOSCA should be aborted, {@code false} otherwise
- */
+ @Override
public boolean isAbort(OperationOutcome outcome) {
return (super.isAbort(outcome) && ABORT_ACTORS.contains(outcome.getActor()));
}
@@ -218,14 +211,9 @@ public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> impleme
storeInDataBase(outcome, getProperty(OperationProperties.AAI_TARGET_ENTITY));
}
- /**
- * Makes a control loop response.
- *
- * @param outcome operation outcome
- * @return a new control loop response, or {@code null} if none is required
- */
+ @Override
public ControlLoopResponse makeControlLoopResponse(OperationOutcome outcome) {
- ControlLoopResponse clRsp = super.makeControlLoopResponse(outcome);
+ var clRsp = super.makeControlLoopResponse(outcome);
Object obj = outcome.getResponse();
if (!(obj instanceof PciMessage)) {
@@ -240,12 +228,7 @@ public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> impleme
return clRsp;
}
- /**
- * Check an event syntax.
- *
- * @param event the event syntax
- * @throws ControlLoopException if an error occurs
- */
+ @Override
protected void checkEventSyntax(VirtualControlLoopEvent event) throws ControlLoopException {
super.checkEventSyntax(event);
validateAaiData(event);
diff --git a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2.java b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2.java
index abc2bcb46..abc9ff2b2 100644
--- a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2.java
+++ b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -154,7 +154,7 @@ public class GuardStep2 extends Step2 {
params.getPayload().put(PAYLOAD_KEY_VNF_ID, targetEntity);
AaiCqResponse cq = this.getCustomQueryData();
- GenericVnf vnf = cq.getGenericVnfByVnfId(targetEntity);
+ var vnf = cq.getGenericVnfByVnfId(targetEntity);
if (vnf == null) {
return;
}
diff --git a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/Step2.java b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/Step2.java
index dbdc6b9fa..78234a783 100644
--- a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/Step2.java
+++ b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/Step2.java
@@ -365,7 +365,7 @@ public class Step2 extends Step {
StandardCoderObject tenant = stepContext.getProperty(AaiGetTenantOperation.getKey(vserver));
verifyNotNull("tenant data", tenant);
- String resourceLink = tenant.getString(RESULT_DATA, 0, RESOURCE_LINK);
+ var resourceLink = tenant.getString(RESULT_DATA, 0, RESOURCE_LINK);
verifyNotNull("tenant data resource-link", resourceLink);
return stripPrefix(resourceLink, 3);
@@ -391,7 +391,7 @@ public class Step2 extends Step {
}
protected String getEnrichment(String propName) {
- String enrichmentKey = propName.substring(ENRICHMENT_PREFIX.length());
+ var enrichmentKey = propName.substring(ENRICHMENT_PREFIX.length());
String value = event.getAai().get(enrichmentKey);
verifyNotNull(propName, value);
@@ -438,7 +438,7 @@ public class Step2 extends Step {
protected static String stripPrefix(String resourceLink, int ncomponents) {
int previdx = -1;
- for (int nslashes = 0; nslashes < ncomponents; ++nslashes) {
+ for (var nslashes = 0; nslashes < ncomponents; ++nslashes) {
int idx = resourceLink.indexOf('/', previdx + 1);
if (idx < 0) {
break;