<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Oleksandr,</p>
<p>it seems that embedded filters (your expressionFilter in this
case) are evaluated before so called quick applicability check is
done for simpleResourceObjectNotifier. So, your filter is invoked
with all kinds of events, not just with resource-related ones.</p>
<p>If you want it to work, you need to include either </p>
<p>"event.isCategoryType(com.evolveum.midpoint.xml.ns._public.common.common_3.EventCategoryType.RESOURCE_OBJECT_EVENT)"
<br>
</p>
<p>or</p>
<p>"event instanceof
com.evolveum.midpoint.notifications.api.events.ResourceObjectEvent"</p>
<p>before calling event.getResourceName().</p>
<p>If I would have a bit of time I would try to improve this event
handling code. But ... it's a question of priorities.</p>
<p>Best regards,<br>
</p>
<pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
</pre>
<div class="moz-cite-prefix">On 22.09.2017 12:12, Oleksandr Nekriach
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CANb693StRxGhRwVPn2WRGHsDVkT+0AJ_xCXeGfHw6KyFkhGJSg@mail.gmail.com">
<div dir="ltr">
<div>
<div>Hello,<br>
</div>
Is it possible to filter notification events by resource name?<br>
</div>
<div>My code:<br>
<simpleResourceObjectNotifier><br>
<status>success</status><br>
<expressionFilter><br>
<script>
<code>event.getResourceName().toString().equalsIgnoreCase("SomeResourcename")</code><br>
</script><br>
</expressionFilter><br>
<transport>mail</transport><br>
</simpleResourceObjectNotifier><br>
<br>
<div>I have tried this code and it works for me but on user
interface and in logs I see the errors<br>
<br>
<i>2017-09-22 13:08:14,133 [] [Thread-42] ERROR
(com.evolveum.midpoint.notifications.impl.helpers.BaseHelper):
Couldn't evaluate event filter expression <br>
Caused by:
com.evolveum.midpoint.util.exception.ExpressionEvaluationException:
groovy.lang.MissingMethodException: No signature of
method:
com.evolveum.midpoint.notifications.api.events.ModelEvent.getResourceName()
is applicable for argument types: () values: [] in (new)
event filter expression</i><br>
<br>
</div>
<div>The same syntax in body section
event.getResourceName().toString() works perfect without
errors .<br>
<br>
Error detail:<br>
<br>
2017-09-22 13:08:14,133 [] [Thread-42] ERROR
(com.evolveum.midpoint.notifications.impl.helpers.BaseHelper):
Couldn't evaluate event filter expression
com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType@48e6b9a8[description=<null>,extension=<null>,trace=<null>,stringFilter=<null>,variable=<null>,returnMultiplicity=<null>,allowEmptyValues=<null>,queryInterpretationOfNoValue=<null>,runAsRef=<null>,expressionEvaluator=[javax.xml.bind.JAXBElement@2f408ce4]],
reason: groovy.lang.MissingMethodException: No signature of
method:
com.evolveum.midpoint.notifications.api.events.ModelEvent.getResourceName()
is applicable for argument types: () values: [] in (new)
event filter expression (class
com.evolveum.midpoint.util.exception.ExpressionEvaluationException)<br>
2017-09-22 13:08:14,248 [] [Thread-42] ERROR
(com.evolveum.midpoint.web.component.progress.ProgressReporter):
Error executing changes.<br>
com.evolveum.midpoint.util.exception.SystemException:
com.evolveum.midpoint.util.exception.ExpressionEvaluationException:
groovy.lang.MissingMethodException: No signature of method:
com.evolveum.midpoint.notifications.api.events.ModelEvent.getResourceName()
is applicable for argument types: () values: [] in (new)
event filter expression<br>
at
com.evolveum.midpoint.notifications.impl.helpers.BaseHelper.evaluateBooleanExpressionChecked(BaseHelper.java:119)
~[notifications-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.notifications.impl.helpers.ExpressionFilterHelper.processEvent(ExpressionFilterHelper.java:51)
~[notifications-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.notifications.impl.handlers.AggregatedEventHandler.processEvent(AggregatedEventHandler.java:126)
~[notifications-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.notifications.impl.notifiers.GeneralNotifier.processEvent(GeneralNotifier.java:90)
~[notifications-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.notifications.impl.handlers.AggregatedEventHandler.processNotifiers(AggregatedEventHandler.java:154)
~[notifications-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.notifications.impl.handlers.AggregatedEventHandler.processEvent(AggregatedEventHandler.java:132)
~[notifications-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.notifications.impl.NotificationManagerImpl.processEvent(NotificationManagerImpl.java:180)
~[notifications-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.notifications.impl.NotificationManagerImpl.processNotifications(NotificationManagerImpl.java:174)
~[notifications-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.notifications.impl.NotificationManagerImpl.processEvent(NotificationManagerImpl.java:165)
~[notifications-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.notifications.impl.NotificationChangeHook.emitModelEvent(NotificationChangeHook.java:139)
~[notifications-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.notifications.impl.NotificationChangeHook.invoke(NotificationChangeHook.java:98)
~[notifications-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.impl.lens.Clockwork.invokeHooks(Clockwork.java:424)
~[model-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.impl.lens.Clockwork.click(Clockwork.java:338)
~[model-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.impl.lens.Clockwork.run(Clockwork.java:203)
~[model-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.impl.controller.ModelController.executeChanges(ModelController.java:569)
~[model-impl-3.6.jar:na]<br>
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[na:1.8.0_131]<br>
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[na:1.8.0_131]<br>
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.8.0_131]<br>
at java.lang.reflect.Method.invoke(Method.java:498)
~[na:1.8.0_131]<br>
at
org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:507)
~[wicket-ioc-7.6.0.jar:7.6.0]<br>
at com.sun.proxy.$Proxy161.executeChanges(Unknown
Source) ~[na:na]<br>
at
com.evolveum.midpoint.web.component.progress.ProgressReporter.lambda$executeChangesAsync$0(ProgressReporter.java:187)
~[classes/:na]<br>
at java.lang.Thread.run(Thread.java:748)
~[na:1.8.0_131]<br>
Caused by:
com.evolveum.midpoint.util.exception.ExpressionEvaluationException:
groovy.lang.MissingMethodException: No signature of method:
com.evolveum.midpoint.notifications.api.events.ModelEvent.getResourceName()
is applicable for argument types: () values: [] in (new)
event filter expression<br>
at
com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:113)
~[model-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.common.expression.script.ScriptExpression.evaluate(ScriptExpression.java:106)
~[model-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.common.expression.script.ScriptExpressionEvaluator.transformSingleValue(ScriptExpressionEvaluator.java:61)
~[model-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator.evaluateScriptExpression(AbstractValueTransformationExpressionEvaluator.java:261)
~[model-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator.evaluateAbsoluteExpression(AbstractValueTransformationExpressionEvaluator.java:191)
~[model-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator.evaluate(AbstractValueTransformationExpressionEvaluator.java:95)
~[model-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.repo.common.expression.Expression.evaluateExpressionEvaluators(Expression.java:201)
~[repo-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.repo.common.expression.Expression.evaluate(Expression.java:146)
~[repo-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.impl.expr.ModelExpressionThreadLocalHolder.evaluateExpressionInContext(ModelExpressionThreadLocalHolder.java:106)
~[model-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.notifications.impl.helpers.BaseHelper.evaluateBooleanExpression(BaseHelper.java:130)
~[notifications-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.notifications.impl.helpers.BaseHelper.evaluateBooleanExpressionChecked(BaseHelper.java:108)
~[notifications-impl-3.6.jar:na]<br>
... 22 common frames omitted<br>
Caused by: javax.script.ScriptException:
groovy.lang.MissingMethodException: No signature of method:
com.evolveum.midpoint.notifications.api.events.ModelEvent.getResourceName()
is applicable for argument types: () values: []<br>
at
org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:347)
~[groovy-all-2.4.0.jar:2.4.0]<br>
at
org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:41)
~[groovy-all-2.4.0.jar:2.4.0]<br>
at
javax.script.CompiledScript.eval(CompiledScript.java:92)
~[na:1.8.0_131]<br>
at
com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:111)
~[model-common-3.6.jar:na]<br>
... 32 common frames omitted<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
<div>Please help<br>
<br>
</div>
<div>
<div>-- <br>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr"><span style="color:rgb(76,76,76)">Best
regards, <br>
<br>
Oleksandr Nekriach | Identity and access
management engineer <br>
<br>
Dynatech, Mednieku str. 4a, Riga, LV-1010,
Latvia <br>
<br>
<div style="display:inline-block"><a
href="tel:+371%2025%20314%20685"
value="+37125314685" target="_blank"
moz-do-not-send="true">+37125314685</a></div>
,
<div style="display:inline-block"><a
href="mailto:o.nekriach@dynatech.lv"
target="_blank" moz-do-not-send="true">o.nekriach@dynatech.lv</a></div>
|
<div style="display:inline-block"><a
href="http://www.dynatech.lv"
target="_blank" moz-do-not-send="true">www.dynatech.lv</a></div>
<br>
<br>
<img
src="cid:part4.7E9E61FF.9EB33839@evolveum.com"
class=""> <br>
<br>
Stay connected: <br>
<div style="display:inline-block;margin:5px 5px
0px 0px"><a
href="https://www.facebook.com/DynatechLatvia/?ref=br_rs"
target="_blank" moz-do-not-send="true"><img
src="cid:part5.205CBE2C.BB122E61@evolveum.com" class=""></a></div>
<div style="display:inline-block;margin:5px 0px
0px"><a
href="https://www.linkedin.com/company-beta/17893047/"
target="_blank" moz-do-not-send="true"><img
src="cid:part7.1169B1B0.7AE13D44@evolveum.com" class=""></a></div>
<br>
<br>
<span
style="font-size:11px;color:rgb(161,161,161)">Confidentiality
Notice: This message contains confidential
information and is intended only for the named
recipient(s). If you are not the addressee you
may not copy, distribute or perform any other
activities with this information. If you have
received this transmission in error, please
notify us by e-mail immediately. E-mail
transmission cannot be guaranteed to be secure
or error-free as information could be
intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.</span></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
</blockquote>
<br>
</body>
</html>