aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/templates/archetype-cl-amsterdam/src
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/templates/archetype-cl-amsterdam/src')
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl22
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());
//