Fix Abatement Processing 91/21491/5
authordaniel <dc443y@att.com>
Tue, 31 Oct 2017 12:37:41 +0000 (07:37 -0500)
committerdaniel <dc443y@att.com>
Tue, 31 Oct 2017 16:41:54 +0000 (11:41 -0500)
The drools engine will now only fire the event rule if the
event is an onset. This prevents abatements from being processed
as onsets.

Issue-Id: POLICY-407
Change-Id: Ic74efa74fbb1dc0e01d7c36a06fdaf48fc8a3238
Signed-off-by: Daniel Cruz <dc443y@att.com>
controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl

index 93b4e0a..acc9806 100644 (file)
@@ -203,6 +203,8 @@ rule "${policyName}.EVENT"
             // Retract it from memory
             //
             retract($event);
+        } else if ($event.closedLoopEventStatus != ControlLoopEventStatus.ONSET) {
+               throw new ControlLoopException($event.closedLoopEventStatus + " received with no prior onset");
         } else {
             //
             // Create an EventManager
@@ -261,7 +263,7 @@ rule "${policyName}.EVENT"
         
         VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
         notification.notification = ControlLoopNotificationType.REJECTED;
-        notification.message = "Exception occurred " + e.getMessage();
+        notification.message = "Exception occurred: " + e.getMessage();
         notification.policyName = drools.getRule().getName();
         notification.policyScope = "${policyScope}";
         notification.policyVersion = "${policyVersion}";