<div dir="ltr"><div><div>Hello Pavol,<br><br></div>I have catch the idea and fixed code and now everything works perfect.<br><br></div>Thank you!<br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-09-22 13:23 GMT+03:00 Pavol Mederly <span dir="ltr"><<a href="mailto:mederly@evolveum.com" target="_blank">mederly@evolveum.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div 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.<wbr>evolveum.midpoint.xml.ns._<wbr>public.common.common_3.<wbr>EventCategoryType.RESOURCE_<wbr>OBJECT_EVENT)"
<br>
</p>
<p>or</p>
<p>"event instanceof
com.evolveum.midpoint.<wbr>notifications.api.events.<wbr>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="m_-5337925636852779195moz-signature" cols="72">Pavol Mederly
Software developer
<a href="http://evolveum.com" target="_blank">evolveum.com</a>
</pre><div><div class="h5">
<div class="m_-5337925636852779195moz-cite-prefix">On 22.09.2017 12:12, Oleksandr Nekriach
wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div class="h5">
<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().<wbr>toString().equalsIgnoreCase("<wbr>SomeResourcename")</code><br>
</script><br>
</expressionFilter><br>
<transport>mail</transport><br>
</<wbr>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.<wbr>notifications.impl.helpers.<wbr>BaseHelper):
Couldn't evaluate event filter expression <br>
Caused by:
com.evolveum.midpoint.util.<wbr>exception.<wbr>ExpressionEvaluationException:
groovy.lang.<wbr>MissingMethodException: No signature of
method:
com.evolveum.midpoint.<wbr>notifications.api.events.<wbr>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().<wbr>toString() works perfect without
errors .<br>
<br>
Error detail:<br>
<br>
2017-09-22 13:08:14,133 [] [Thread-42] ERROR
(com.evolveum.midpoint.<wbr>notifications.impl.helpers.<wbr>BaseHelper):
Couldn't evaluate event filter expression
com.evolveum.midpoint.xml.ns._<wbr>public.common.common_3.<wbr>ExpressionType@48e6b9a8[<wbr>description=<null>,extension=<<wbr>null>,trace=<null>,<wbr>stringFilter=<null>,variable=<<wbr>null>,returnMultiplicity=<<wbr>null>,allowEmptyValues=<null>,<wbr>queryInterpretationOfNoValue=<<wbr>null>,runAsRef=<null>,<wbr>expressionEvaluator=[javax.<wbr>xml.bind.JAXBElement@2f408ce4]<wbr>],
reason: groovy.lang.<wbr>MissingMethodException: No signature of
method:
com.evolveum.midpoint.<wbr>notifications.api.events.<wbr>ModelEvent.getResourceName()
is applicable for argument types: () values: [] in (new)
event filter expression (class
com.evolveum.midpoint.util.<wbr>exception.<wbr>ExpressionEvaluationException)<br>
2017-09-22 13:08:14,248 [] [Thread-42] ERROR
(com.evolveum.midpoint.web.<wbr>component.progress.<wbr>ProgressReporter):
Error executing changes.<br>
com.evolveum.midpoint.util.<wbr>exception.SystemException:
com.evolveum.midpoint.util.<wbr>exception.<wbr>ExpressionEvaluationException:
groovy.lang.<wbr>MissingMethodException: No signature of method:
com.evolveum.midpoint.<wbr>notifications.api.events.<wbr>ModelEvent.getResourceName()
is applicable for argument types: () values: [] in (new)
event filter expression<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.helpers.<wbr>BaseHelper.<wbr>evaluateBooleanExpressionCheck<wbr>ed(BaseHelper.java:119)
~[notifications-impl-3.6.jar:<wbr>na]<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.helpers.<wbr>ExpressionFilterHelper.<wbr>processEvent(<wbr>ExpressionFilterHelper.java:<wbr>51)
~[notifications-impl-3.6.jar:<wbr>na]<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.handlers.<wbr>AggregatedEventHandler.<wbr>processEvent(<wbr>AggregatedEventHandler.java:<wbr>126)
~[notifications-impl-3.6.jar:<wbr>na]<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.notifiers.<wbr>GeneralNotifier.processEvent(<wbr>GeneralNotifier.java:90)
~[notifications-impl-3.6.jar:<wbr>na]<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.handlers.<wbr>AggregatedEventHandler.<wbr>processNotifiers(<wbr>AggregatedEventHandler.java:<wbr>154)
~[notifications-impl-3.6.jar:<wbr>na]<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.handlers.<wbr>AggregatedEventHandler.<wbr>processEvent(<wbr>AggregatedEventHandler.java:<wbr>132)
~[notifications-impl-3.6.jar:<wbr>na]<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.<wbr>NotificationManagerImpl.<wbr>processEvent(<wbr>NotificationManagerImpl.java:<wbr>180)
~[notifications-impl-3.6.jar:<wbr>na]<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.<wbr>NotificationManagerImpl.<wbr>processNotifications(<wbr>NotificationManagerImpl.java:<wbr>174)
~[notifications-impl-3.6.jar:<wbr>na]<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.<wbr>NotificationManagerImpl.<wbr>processEvent(<wbr>NotificationManagerImpl.java:<wbr>165)
~[notifications-impl-3.6.jar:<wbr>na]<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.<wbr>NotificationChangeHook.<wbr>emitModelEvent(<wbr>NotificationChangeHook.java:<wbr>139)
~[notifications-impl-3.6.jar:<wbr>na]<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.<wbr>NotificationChangeHook.invoke(<wbr>NotificationChangeHook.java:<wbr>98)
~[notifications-impl-3.6.jar:<wbr>na]<br>
at
com.evolveum.midpoint.model.<wbr>impl.lens.Clockwork.<wbr>invokeHooks(Clockwork.java:<wbr>424)
~[model-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.<wbr>impl.lens.Clockwork.click(<wbr>Clockwork.java:338)
~[model-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.<wbr>impl.lens.Clockwork.run(<wbr>Clockwork.java:203)
~[model-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.<wbr>impl.controller.<wbr>ModelController.<wbr>executeChanges(<wbr>ModelController.java:569)
~[model-impl-3.6.jar:na]<br>
at
sun.reflect.<wbr>NativeMethodAccessorImpl.<wbr>invoke0(Native Method)
~[na:1.8.0_131]<br>
at
sun.reflect.<wbr>NativeMethodAccessorImpl.<wbr>invoke(<wbr>NativeMethodAccessorImpl.java:<wbr>62)
~[na:1.8.0_131]<br>
at
sun.reflect.<wbr>DelegatingMethodAccessorImpl.<wbr>invoke(<wbr>DelegatingMethodAccessorImpl.<wbr>java:43)
~[na:1.8.0_131]<br>
at java.lang.reflect.Method.<wbr>invoke(Method.java:498)
~[na:1.8.0_131]<br>
at
org.apache.wicket.proxy.<wbr>LazyInitProxyFactory$<wbr>JdkHandler.invoke(<wbr>LazyInitProxyFactory.java:507)
~[wicket-ioc-7.6.0.jar:7.6.0]<br>
at com.sun.proxy.$Proxy161.<wbr>executeChanges(Unknown
Source) ~[na:na]<br>
at
com.evolveum.midpoint.web.<wbr>component.progress.<wbr>ProgressReporter.lambda$<wbr>executeChangesAsync$0(<wbr>ProgressReporter.java:187)
~[classes/:na]<br>
at java.lang.Thread.run(Thread.<wbr>java:748)
~[na:1.8.0_131]<br>
Caused by:
com.evolveum.midpoint.util.<wbr>exception.<wbr>ExpressionEvaluationException:
groovy.lang.<wbr>MissingMethodException: No signature of method:
com.evolveum.midpoint.<wbr>notifications.api.events.<wbr>ModelEvent.getResourceName()
is applicable for argument types: () values: [] in (new)
event filter expression<br>
at
com.evolveum.midpoint.model.<wbr>common.expression.script.<wbr>jsr223.Jsr223ScriptEvaluator.<wbr>evaluate(<wbr>Jsr223ScriptEvaluator.java:<wbr>113)
~[model-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.<wbr>common.expression.script.<wbr>ScriptExpression.evaluate(<wbr>ScriptExpression.java:106)
~[model-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.<wbr>common.expression.script.<wbr>ScriptExpressionEvaluator.<wbr>transformSingleValue(<wbr>ScriptExpressionEvaluator.<wbr>java:61)
~[model-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.<wbr>common.expression.evaluator.<wbr>AbstractValueTransformationExp<wbr>ressionEvaluator.<wbr>evaluateScriptExpression(<wbr>AbstractValueTransformationExp<wbr>ressionEvaluator.java:261)
~[model-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.<wbr>common.expression.evaluator.<wbr>AbstractValueTransformationExp<wbr>ressionEvaluator.<wbr>evaluateAbsoluteExpression(<wbr>AbstractValueTransformationExp<wbr>ressionEvaluator.java:191)
~[model-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.<wbr>common.expression.evaluator.<wbr>AbstractValueTransformationExp<wbr>ressionEvaluator.evaluate(<wbr>AbstractValueTransformationExp<wbr>ressionEvaluator.java:95)
~[model-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.repo.<wbr>common.expression.Expression.<wbr>evaluateExpressionEvaluators(<wbr>Expression.java:201)
~[repo-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.repo.<wbr>common.expression.Expression.<wbr>evaluate(Expression.java:146)
~[repo-common-3.6.jar:na]<br>
at
com.evolveum.midpoint.model.<wbr>impl.expr.<wbr>ModelExpressionThreadLocalHold<wbr>er.<wbr>evaluateExpressionInContext(<wbr>ModelExpressionThreadLocalHold<wbr>er.java:106)
~[model-impl-3.6.jar:na]<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.helpers.<wbr>BaseHelper.<wbr>evaluateBooleanExpression(<wbr>BaseHelper.java:130)
~[notifications-impl-3.6.jar:<wbr>na]<br>
at
com.evolveum.midpoint.<wbr>notifications.impl.helpers.<wbr>BaseHelper.<wbr>evaluateBooleanExpressionCheck<wbr>ed(BaseHelper.java:108)
~[notifications-impl-3.6.jar:<wbr>na]<br>
... 22 common frames omitted<br>
Caused by: javax.script.ScriptException:
groovy.lang.<wbr>MissingMethodException: No signature of method:
com.evolveum.midpoint.<wbr>notifications.api.events.<wbr>ModelEvent.getResourceName()
is applicable for argument types: () values: []<br>
at
org.codehaus.groovy.jsr223.<wbr>GroovyScriptEngineImpl.eval(<wbr>GroovyScriptEngineImpl.java:<wbr>347)
~[groovy-all-2.4.0.jar:2.4.0]<br>
at
org.codehaus.groovy.jsr223.<wbr>GroovyCompiledScript.eval(<wbr>GroovyCompiledScript.java:41)
~[groovy-all-2.4.0.jar:2.4.0]<br>
at
javax.script.CompiledScript.<wbr>eval(CompiledScript.java:92)
~[na:1.8.0_131]<br>
at
com.evolveum.midpoint.model.<wbr>common.expression.script.<wbr>jsr223.Jsr223ScriptEvaluator.<wbr>evaluate(<wbr>Jsr223ScriptEvaluator.java:<wbr>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="m_-5337925636852779195gmail_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">+37125314685</a></div>
,
<div style="display:inline-block"><a href="mailto:o.nekriach@dynatech.lv" target="_blank">o.nekriach@dynatech.lv</a></div>
|
<div style="display:inline-block"><a href="http://www.dynatech.lv" target="_blank">www.dynatech.lv</a></div>
<br>
<br>
<img src="cid:part4.7E9E61FF.9EB33839@evolveum.com"> <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"><img src="cid:part5.205CBE2C.BB122E61@evolveum.com"></a></div>
<div style="display:inline-block;margin:5px 0px 0px"><a href="https://www.linkedin.com/company-beta/17893047/" target="_blank"><img src="cid:part7.1169B1B0.7AE13D44@evolveum.com"></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="m_-5337925636852779195mimeAttachmentHeader"></fieldset>
<br>
</div></div><pre>______________________________<wbr>_________________
midPoint mailing list
<a class="m_-5337925636852779195moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a>
<a class="m_-5337925636852779195moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/<wbr>mailman/listinfo/midpoint</a>
</pre>
</blockquote>
<br>
</div>
<br>______________________________<wbr>_________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a><br>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" rel="noreferrer" target="_blank">http://lists.evolveum.com/<wbr>mailman/listinfo/midpoint</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="color:#4c4c4c">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">+37125314685</a></div>, <div style="display:inline-block"><a href="mailto:o.nekriach@dynatech.lv" target="_blank">o.nekriach@dynatech.lv</a></div> | <div style="display:inline-block"><a href="http://www.dynatech.lv" target="_blank">www.dynatech.lv</a></div> <br><br><img src="cid:o.nekriach@dynatech.lv1502777022855-7770"> <br><br>Stay connected: <br><div style="display:inline-block;margin:5px 5px 0 0"><a href="https://www.facebook.com/DynatechLatvia/?ref=br_rs" target="_blank"><img src="cid:o.nekriach@dynatech.lv1502777022855-7771"></a></div><div style="display:inline-block;margin:5px 0 0 0"><a href="https://www.linkedin.com/company-beta/17893047/" target="_blank"><img src="cid:o.nekriach@dynatech.lv1502777022855-7772"></a></div><br><br><span style="font-size:11px;color:#a1a1a1">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>