summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/main
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-09-27 12:28:19 -0400
committerPamela Dragosh <pdragosh@research.att.com>2018-09-27 16:59:41 -0400
commit1253af9756e8a7027fade727da68b38dff2d5159 (patch)
tree39b785d0ddad197933e6e3df4b21376f1d57ef9e /controlloop/common/eventmanager/src/main
parent1c32e0c17febcbef90756f3eef4868542723cc81 (diff)
Fix more sonar issues
Most of these are minor issues along with a few others. They have been bugging me so I thought I would get them done. Some also do not show up on sonarlint. Issue-ID: POLICY-1129 Change-Id: I31f2765f6babdfa80b23f0589daacc98da8d2002 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/main')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java115
1 files changed, 56 insertions, 59 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
index c5344e38b..0b2c14e54 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
@@ -64,14 +64,6 @@ public class ControlLoopOperationManager implements Serializable {
private static final String GENERIC_VNF_VNF_NAME = "generic-vnf.vnf-name";
private static final String GENERIC_VNF_VNF_ID = "generic-vnf.vnf-id";
- @Override
- public String toString() {
- return "ControlLoopOperationManager [onset=" + (onset != null ? onset.getRequestId() : "null") + ", policy="
- + (policy != null ? policy.getId() : "null") + ", attempts=" + attempts + ", policyResult="
- + policyResult + ", currentOperation=" + currentOperation + ", operationHistory=" + operationHistory
- + "]";
- }
-
//
// These properties are not changeable, but accessible
// for Drools Rule statements.
@@ -88,6 +80,51 @@ public class ControlLoopOperationManager implements Serializable {
private PolicyResult policyResult = null;
private ControlLoopEventManager eventManager = null;
private String targetEntity;
+ private String guardApprovalStatus = "NONE";// "NONE", "PERMIT", "DENY"
+ private transient Object operationRequest;
+
+ /**
+ * Construct an instance.
+ *
+ * @param onset the onset event
+ * @param policy the policy
+ * @param em the event manager
+ * @throws ControlLoopException if an error occurs
+ * @throws AaiException if an error occurs retrieving information from A&AI
+ */
+ public ControlLoopOperationManager(ControlLoopEvent onset, Policy policy, ControlLoopEventManager em)
+ throws ControlLoopException, AaiException {
+ this.onset = onset;
+ this.policy = policy;
+ this.guardApprovalStatus = "NONE";
+ this.eventManager = em;
+ this.targetEntity = getTarget(policy);
+
+ //
+ // Let's make a sanity check
+ //
+ switch (policy.getActor()) {
+ case "APPC":
+ if ("ModifyConfig".equalsIgnoreCase(policy.getRecipe())) {
+ /*
+ * The target vnf-id may not be the same as the source vnf-id specified in the
+ * yaml, the target vnf-id is retrieved by a named query to A&AI.
+ */
+ String targetVnf = AppcLcmActorServiceProvider.vnfNamedQuery(policy.getTarget().getResourceID(),
+ this.targetEntity);
+ this.targetEntity = targetVnf;
+ }
+ break;
+ case "SO":
+ break;
+ case "SDNR":
+ break;
+ case "VFC":
+ break;
+ default:
+ throw new ControlLoopException("ControlLoopEventManager: policy has an unknown actor.");
+ }
+ }
public ControlLoopEventManager getEventManager() {
return eventManager;
@@ -101,6 +138,14 @@ public class ControlLoopOperationManager implements Serializable {
return this.targetEntity;
}
+ @Override
+ public String toString() {
+ return "ControlLoopOperationManager [onset=" + (onset != null ? onset.getRequestId() : "null") + ", policy="
+ + (policy != null ? policy.getId() : "null") + ", attempts=" + attempts + ", policyResult="
+ + policyResult + ", currentOperation=" + currentOperation + ", operationHistory=" + operationHistory
+ + "]";
+ }
+
//
// Internal class used for tracking
//
@@ -118,9 +163,6 @@ public class ControlLoopOperationManager implements Serializable {
}
}
- private String guardApprovalStatus = "NONE";// "NONE", "PERMIT", "DENY"
- private transient Object operationRequest;
-
public Object getOperationRequest() {
return operationRequest;
}
@@ -185,49 +227,6 @@ public class ControlLoopOperationManager implements Serializable {
}
/**
- * Construct an instance.
- *
- * @param onset the onset event
- * @param policy the policy
- * @param em the event manager
- * @throws ControlLoopException if an error occurs
- * @throws AaiException if an error occurs retrieving information from A&AI
- */
- public ControlLoopOperationManager(ControlLoopEvent onset, Policy policy, ControlLoopEventManager em)
- throws ControlLoopException, AaiException {
- this.onset = onset;
- this.policy = policy;
- this.guardApprovalStatus = "NONE";
- this.eventManager = em;
- this.targetEntity = getTarget(policy);
-
- //
- // Let's make a sanity check
- //
- switch (policy.getActor()) {
- case "APPC":
- if ("ModifyConfig".equalsIgnoreCase(policy.getRecipe())) {
- /*
- * The target vnf-id may not be the same as the source vnf-id specified in the
- * yaml, the target vnf-id is retrieved by a named query to A&AI.
- */
- String targetVnf = AppcLcmActorServiceProvider.vnfNamedQuery(policy.getTarget().getResourceID(),
- this.targetEntity);
- this.targetEntity = targetVnf;
- }
- break;
- case "SO":
- break;
- case "SDNR":
- break;
- case "VFC":
- break;
- default:
- throw new ControlLoopException("ControlLoopEventManager: policy has an unknown actor.");
- }
- }
-
- /**
* Start an operation.
*
* @param onset the onset event
@@ -548,7 +547,7 @@ public class ControlLoopOperationManager implements Serializable {
* @return The result of the response handling
*/
private PolicyResult onResponse(VFCResponse vfcResponse) {
- if (vfcResponse.getResponseDescriptor().getStatus().equalsIgnoreCase("finished")) {
+ if ("finished".equalsIgnoreCase(vfcResponse.getResponseDescriptor().getStatus())) {
//
// Consider it as success
//
@@ -797,8 +796,6 @@ public class ControlLoopOperationManager implements Serializable {
throw new ControlLoopException("current oepration has failed after " + this.attempts + " retries");
}
}
-
- return;
}
private boolean isRetriesMaxedOut() {
@@ -833,7 +830,7 @@ public class ControlLoopOperationManager implements Serializable {
String opsHistPu = System.getProperty("OperationsHistoryPU");
- if (opsHistPu == null || !opsHistPu.equals("TestOperationsHistoryPU")) {
+ if (!"TestOperationsHistoryPU".equals(opsHistPu)) {
opsHistPu = "OperationsHistoryPU";
} else {
props.clear();
@@ -914,7 +911,7 @@ public class ControlLoopOperationManager implements Serializable {
* @param outcome the abatement outcome
*/
public void commitAbatement(String message, String outcome) {
- logger.info("commitAbatement: " + message + ", " + outcome);
+ logger.info("commitAbatement: {}. {}", message, outcome);
if (this.currentOperation == null) {
try {