From 71aacf6cf96b35020937aefc799122ab695f2a31 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 10 Aug 2018 18:16:21 -0400 Subject: update AAI response classes per API Several of the AAI response classes did not match the new AAI interface. Updated AaiGetVnfResponse and AaiGetVserverResponse and the classes they use to reflect the new API; other top-level classes were left untouched. Fix checkstyle errors. Change-Id: Ife5830c45ba8aece8d676a10f0fd8a9c9fe6cb66 Issue-ID: POLICY-964 Signed-off-by: Jim Hahn --- .../eventmanager/ControlLoopEventManager.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'controlloop/common/eventmanager/src/main/java') diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java index fa608ca08..2c1b6f628 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java @@ -26,11 +26,13 @@ import java.net.URLDecoder; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList; +import java.util.List; import java.util.UUID; import org.onap.policy.aai.AaiGetVnfResponse; import org.onap.policy.aai.AaiGetVserverResponse; import org.onap.policy.aai.AaiManager; +import org.onap.policy.aai.AaiNqVServer; import org.onap.policy.aai.util.AaiException; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopException; @@ -708,12 +710,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable { throw new AaiException("AAI Responded with a request error (query by " + queryTypeString + ")"); } - if (aaiResponse.getIsClosedLoopDisabled() != null) { - String value = aaiResponse.getIsClosedLoopDisabled(); - if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value) - || "Y".equalsIgnoreCase(value)) { - throw new AaiException("is-closed-loop-disabled is set to true (query by " + queryTypeString + ")"); - } + if (aaiResponse.getIsClosedLoopDisabled()) { + throw new AaiException("is-closed-loop-disabled is set to true (query by " + queryTypeString + ")"); } } @@ -724,13 +722,15 @@ public class ControlLoopEventManager implements LockCallback, Serializable { if (aaiResponse.getRequestError() != null) { throw new AaiException("AAI responded with a request error (query by vserver-name)"); } - - if (aaiResponse.getIsClosedLoopDisabled() != null) { - String value = aaiResponse.getIsClosedLoopDisabled(); - if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value) - || "Y".equalsIgnoreCase(value)) { - throw new AaiException("is-closed-loop-disabled is set to true (query by vserver-name)"); - } + + List lst = aaiResponse.getVserver(); + if(lst.isEmpty()) { + return; + } + + AaiNqVServer svr = lst.get(0); + if (svr.getIsClosedLoopDisabled()) { + throw new AaiException("is-closed-loop-disabled is set to true (query by vserver-name)"); } } -- cgit 1.2.3-korg