diff options
author | 2017-10-18 17:02:33 +0000 | |
---|---|---|
committer | 2017-10-18 17:02:33 +0000 | |
commit | 0f4579198b531a38cdef06bbeb4f51302730e4ba (patch) | |
tree | aacfee9bfe6dde471f36e813667705d33350ebb3 /controlloop/templates/archetype-cl-amsterdam | |
parent | f7f46f9c7ddbd7918b428649a766366d6c912b89 (diff) | |
parent | 506267bf7e9d961f1a6b2a989ee8a23ca67b9d61 (diff) |
Merge "Add support for AAI Named Query error handling"
Diffstat (limited to 'controlloop/templates/archetype-cl-amsterdam')
-rw-r--r-- | controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl index 3d6d89c69..705bbcd25 100644 --- a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl @@ -32,6 +32,7 @@ import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager; import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager.NEW_EVENT_STATUS; import org.onap.policy.controlloop.eventmanager.ControlLoopOperationManager; import org.onap.policy.controlloop.actor.so.SOActorServiceProvider; +import org.onap.policy.aai.util.AAIException; import org.onap.policy.appc.Request; import org.onap.policy.appc.Response; import org.onap.policy.appc.CommonHeader; @@ -507,6 +508,7 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" $manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID, "Permit".equalsIgnoreCase(getGuardApprovalStatus()) ) $lock : TargetLock (requestID == $event.requestID) + $opTimer : OperationTimer( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID.toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -514,9 +516,23 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" $params.getClosedLoopControlName(), drools.getRule().getName(), $event, $manager, $operation, $lock); - Object request = $operation.startOperation($event); - - if (request != null) { + Object request = null; + boolean caughtException = false; + try { + request = $operation.startOperation($event); + } + catch (AAIException e) { + //We got an exception, retract everything for this current operation + $operation.setOperationHasException(e.getMessage()); + retract($opTimer); + retract($operation); + caughtException = true; + } + //Having the modify statement in the catch clause doesn't work for whatever reason + if (caughtException) { + modify($manager) {finishOperation($operation)}; + } + else if (request != null) { logger.debug("{}: {}: starting operation ..", $params.getClosedLoopControlName(), drools.getRule().getName()); // |