aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-05-15 16:08:59 -0400
committerJim Hahn <jrh3@att.com>2018-05-15 16:10:06 -0400
commit926a96f051c67936449a79836933986f041a9612 (patch)
tree299fccf311bbbefd0f2139d4fa306e7c2ca196b8
parentd87e09acbd1e1802f1bf5f37a413cef6a81ee126 (diff)
Add rule to cleanup onsets without Params
Change-Id: I0040a3be47d56808e2cda8a5ab2d3c1aa8e9fbb9 Issue-ID: POLICY-796 Signed-off-by: Jim Hahn <jrh3@att.com>
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl20
1 files changed, 20 insertions, 0 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 522a8ecdf..fba1ee3ac 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
@@ -1238,3 +1238,23 @@ rule "${policyName}.EVENT.MANAGER.TIMEOUT"
}
}
end
+
+/*
+*
+* This rule will clean up any rogue onsets where there is no
+* ControlLoopParams object corresponding to the onset event.
+*
+*/
+rule "EVENT.CLEANUP"
+ when
+ $event : VirtualControlLoopEvent( $clName: closedLoopControlName )
+ not ( Params( getClosedLoopControlName() == $clName) )
+ then
+
+ Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
+ logger.info("{}: {}", $clName, drools.getRule().getName());
+ logger.debug("{}: {}: orphan onset event={}",
+ $clName, drools.getRule().getName(), $event);
+
+ retract($event);
+end