<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">reply to myself, the notification manager can be get by :
<br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>import com.evolveum.midpoint.wf.impl.processes.common.SpringApplicationContextHolder
<span><br>
NotificationManager notificationManager = SpringApplicationContextHolder.getBean("notificationManagerImpl", NotificationManager.class)</span></div>
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I'm not sure that is the right way ... by it work
<br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<br>
<p style="margin-top:0; margin-bottom:0">Cordialement. </p>
<table class="MsoNormalTable" style="width:100.0%; border:none; border-top:solid #00BBDF 3.0pt" width="100%" cellspacing="0" cellpadding="0" border="1">
<tbody>
<tr>
<td style="border:medium none; padding:0cm; width:301px" valign="top"></td>
</tr>
</tbody>
</table>
<table class="ms-rteTable-clear" style="border-collapse:collapse; table-layout:fixed; border:1px solid transparent" cellspacing="0">
<tbody>
<tr class="ms-rteTableEvenRow-clear" style="border-collapse:collapse; border:1px solid transparent; background-color:rgba(255,255,255,0.85)">
<td class="ms-rteTableEvenCol-clear" style="border-collapse:collapse; width:208px; border:1px solid transparent">
<b><span style="background-color:rgb(255,255,255); color:rgb(0,111,201)">Sylvaire-Kevin TIPA</span></b><br>
<div><i><span style="font-size:10pt; color:rgb(117,123,128)">Thales Services / OIC INFRAS</span><br>
</i><span style="font-size:10pt; color:rgb(117,123,128)"><i>Devops Infrastructure Automation</i></span></div>
</td>
<td class="ms-rteTableOddCol-clear" colspan="1" style="border-collapse:collapse; width:23px; border:1px solid transparent">
<br>
</td>
<td class="ms-rteTableEvenCol-clear" style="border-collapse:collapse; width:188px; border:1px solid transparent" align="right">
<img class="EmojiInsert" src="cid:068d6bed-3cf4-403e-a790-5ed4030ae567"><br>
</td>
</tr>
<tr class="ms-rteTableOddRow-clear" style="border-collapse:collapse; border:1px solid transparent; background-color:rgba(255,255,255,0.85)">
<td class="ms-rteTableEvenCol-clear" style="border-collapse:collapse; border:1px solid transparent">
<br>
</td>
<td class="ms-rteTableOddCol-clear" colspan="1" style="border-collapse:collapse; border:1px solid transparent">
<br>
</td>
<td class="ms-rteTableEvenCol-clear" style="border-collapse:collapse; border:1px solid transparent">
<br>
</td>
</tr>
<tr class="ms-rteTableEvenRow-clear" style="border-collapse:collapse; border:1px solid transparent; background-color:rgba(255,255,255,0.85)">
<td class="ms-rteTableEvenCol-clear" style="border-collapse:collapse; border:1px solid transparent">
<div><span style="color:rgb(117,123,128)">THALES SERVICES SAS</span><br>
<span style="color:rgb(117,123,128)">44 Quai Charles de Gaulle</span><br>
<span style="color:rgb(117,123,128)">CS 20100</span><br>
<span style="color:rgb(117,123,128)">69463 Lyon Cedex 06</span></div>
</td>
<td class="ms-rteTableOddCol-clear" colspan="1" style="border-collapse:collapse; border:1px solid transparent">
<br>
</td>
<td class="ms-rteTableEvenCol-clear" style="border-collapse:collapse; border:1px solid transparent">
<br>
</td>
</tr>
</tbody>
</table>
<span style="font-size:8pt; color:rgb(117,123,128)">--------------------------------------------------<br>
<a href="http://www.thalesgroup.com" class="OWAAutoLink" id="LPNoLP">www.thalesgroup.com</a><br>
</span><i></i>
<p></p>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De :</b> midPoint <midpoint-bounces@lists.evolveum.com> de la part de Sylvaire kevin TIPA <sylvaire-kevin.tipa@mythalesgroup.io><br>
<b>Envoyé :</b> mercredi 18 avril 2018 16:20:44<br>
<b>À :</b> midpoint@lists.evolveum.com<br>
<b>Objet :</b> [midPoint] Custom Event - notificationManager</font>
<div> </div>
</div>
<style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<table id="msexchangesafetytips;0d000f0b-0319-4809-bc87-08d5a538a3d7;R:fr-FR" border="0" cellspacing="0" cellpadding="0" width="100%" align="left" style="border:0; display:table; width:100%; table-layout:fixed; border-collapse:seperate; float:none">
<tbody>
<tr>
<td valign="middle" width="1px" bgcolor="#910A19" cellpadding="7px 2px 7px 2px" style="padding:7px 2px 7px 2px; background-color:#910A19">
</td>
<td valign="middle" width="100%" bgcolor="#FDF2F4" cellpadding="7px 5px 7px 15px" color="#212121" style="width:100%; background-color:#FDF2F4; padding:7px 5px 7px 15px; font-family:wf_segoe-ui_normal,Segoe UI,Segoe WP,Tahoma,Arial,sans-serif; font-size:12px; font-weight:normal; color:#212121; text-align:left; word-wrap:break-word">
<div>Cet expéditeur n’a pas passé les vérifications relatives à la détection des fraudes et n’est peut-être pas la personne qu’il prétend être. En savoir plus sur l’<a href="http://aka.ms/LearnAboutSpoofing"> usurpation d’identités</a></div>
</td>
<td valign="middle" align="left" width="75px" bgcolor="#FDF2F4" cellpadding="7px 5px 7px 5px" color="#212121" style="width:75px; background-color:#FDF2F4; padding:7px 5px 7px 5px; font-family:wf_segoe-ui_normal,Segoe UI,Segoe WP,Tahoma,Arial,sans-serif; font-size:12px; font-weight:normal; color:#212121; text-align:left; word-wrap:break-word">
<a href="http://aka.ms/SafetyTipsFeedback">Votre avis</a></td>
</tr>
</tbody>
</table>
<div>
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0; margin-bottom:0">Hello,</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">I try (so hard) to generate custom event in Java, but I get a NULL pointer exception each time...
<br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Follow the documentation, we just have this information :
<br>
</p>
<p style="margin-top:0; margin-bottom:0"></p>
<div class="x_container" title="Hint: double-click to select code">
<div class="x_line x_number1 x_index0 x_alt2"><code class="x_java x_plain">Event event =
</code><code class="x_java x_keyword">new</code> <code class="x_java x_plain">CustomEvent(lightweightIdentifierGenerator, subtype, handler, item, operation, status, channel);</code></div>
<div class="x_line x_number2 x_index1 x_alt1"><code class="x_java x_plain">notificationManager.processEvent(event, task, result);</code></div>
</div>
<p></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">So I create a custom Event correctly (I think) but the process event always fail ... I'm not sure about "How I can get
<code class="x_java x_plain">notificationManager</code> object"... <br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">I work in Hook in userType / primary. Anyone know how to generate custom event ?<br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">See my code : <br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"><span>NotificationManager notificationManager = new NotificationManagerImpl() //Probably wrong ! </span></p>
<p style="margin-top:0; margin-bottom:0"><span>Event event = new CustomEvent(lightweightIdentifierGenerator, "CustomUserRegistrationNotifier", null, user, EventOperationType.ADD, EventStatusType.SUCCESS, null);</span></p>
<p style="margin-top:0; margin-bottom:0"><span>notificationManager.processEvent(event)
<br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>Here the log : <br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span></p>
<div>Caused by: java.lang.NullPointerException: null<br>
        at com.evolveum.midpoint.notifications.impl.NotificationManagerImpl.processEvent(NotificationManagerImpl.java:102)</div>
My event object : <br>
</span>
<p></p>
<p style="margin-top:0; margin-bottom:0"><span></p>
<div>>>>event  CustomEvent<br>
    id: 1524061049969-0-1<br>
    requester: null<br>
    requestee: null<br>
    subtype: CustomUserRegistrationNotifier</div>
<br>
</span>
<p></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>According to the error log, the source code with problem is in <a href="https://github.com/Evolveum/midpoint/blob/80956776707531988908314f7dc1ef47a1e9b25b/model/notifications-impl/src/main/java/com/evolveum/midpoint/notifications/impl/NotificationManagerImpl.java" class="x_OWAAutoLink" id="LPlnk898856">https://github.com/Evolveum/midpoint/blob/80956776707531988908314f7dc1ef47a1e9b25b/model/notifications-impl/src/main/java/com/evolveum/midpoint/notifications/impl/NotificationManagerImpl.java</a>
 ligne 102 : </p>
<div id="LPBorder_GT_15240611599080.4927771797040431" style="margin-bottom:20px; overflow:auto; width:100%; text-indent:0px">
<table id="LPContainer_15240611599020.5398541411585995" cellspacing="0" style="width:90%; background-color:rgb(255,255,255); overflow:auto; padding-top:20px; padding-bottom:20px; margin-top:20px; border-top:1px dotted rgb(200,200,200); border-bottom:1px dotted rgb(200,200,200)">
<tbody>
<tr valign="top" style="border-spacing:0px">
<td id="x_ImageCell_15240611599040.811618755774556" colspan="1" style="width:250px; display:table-cell; padding-right:20px">
<div id="LPImageContainer_15240611599040.003132357078344805" style="background-color:rgb(255,255,255); height:250px; margin:auto; display:table; width:250px">
<a id="LPImageAnchor_15240611599040.597060201650834" href="https://github.com/Evolveum/midpoint/blob/80956776707531988908314f7dc1ef47a1e9b25b/model/notifications-impl/src/main/java/com/evolveum/midpoint/notifications/impl/NotificationManagerImpl.java" target="_blank" style="display:table-cell; text-align:center"><img id="LPThumbnailImageID_15240611599040.7259316360750482" width="250" height="250" style="display:inline-block; max-width:250px; max-height:250px; height:250px; width:250px; border-width:0px; vertical-align:bottom" src="https://avatars1.githubusercontent.com/u/6286905?s=400&v=4"></a></div>
</td>
<td id="x_TextCell_15240611599040.08718670032233933" colspan="2" style="vertical-align:top; padding:0px; display:table-cell">
<div id="LPRemovePreviewContainer_15240611599040.40756474927958974"></div>
<div id="LPTitle_15240611599040.3353754313915821" style="top:0px; color:rgb(54,159,71); font-weight:400; font-size:21px; font-family:"wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height:21px">
<a id="LPUrlAnchor_15240611599060.9585511984768772" href="https://github.com/Evolveum/midpoint/blob/80956776707531988908314f7dc1ef47a1e9b25b/model/notifications-impl/src/main/java/com/evolveum/midpoint/notifications/impl/NotificationManagerImpl.java" target="_blank" style="text-decoration:none">Evolveum/midpoint</a></div>
<div id="LPMetadata_15240611599060.5440761773250483" style="margin:10px 0px 16px; color:rgb(102,102,102); font-weight:400; font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:14px">
github.com</div>
<div id="LPDescription_15240611599060.329645598351604" style="display:block; color:rgb(102,102,102); font-weight:400; font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:20px; max-height:100px; overflow:hidden">
midpoint - MidPoint Identity Manager</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</span>
<p></p>
<p style="margin-top:0; margin-bottom:0"><span></p>
<div><span class="x_pl-smi">Task</span> task <span class="x_pl-k">=</span> taskManager<span class="x_pl-k">.</span>createTaskInstance(<span class="x_pl-c1">OPERATION_PROCESS_EVENT</span>);<br>
<br>
MP : 3.6<br>
</div>
</span><br>
<p></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<div id="x_Signature">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<br>
<p style="margin-top:0; margin-bottom:0">Cordialement. </p>
<table class="x_MsoNormalTable" width="100%" cellspacing="0" cellpadding="0" border="1" style="width:100.0%; border:none; border-top:solid #00BBDF 3.0pt">
<tbody>
<tr>
<td valign="top" style="border:medium none; padding:0cm; width:301px"></td>
</tr>
</tbody>
</table>
<table class="x_ms-rteTable-clear" cellspacing="0" style="border-collapse:collapse; table-layout:fixed; border:1px solid transparent">
<tbody>
<tr class="x_ms-rteTableEvenRow-clear" style="border-collapse:collapse; border:1px solid transparent; background-color:rgba(255,255,255,0.85)">
<td class="x_ms-rteTableEvenCol-clear" style="border-collapse:collapse; width:208px; border:1px solid transparent">
<b><span style="background-color:rgb(255,255,255); color:rgb(0,111,201)">Sylvaire-Kevin TIPA</span></b><br>
<div><i><span style="font-size:10pt; color:rgb(117,123,128)">Thales Services / OIC INFRAS</span><br>
</i><span style="font-size:10pt; color:rgb(117,123,128)"><i>Devops Infrastructure Automation</i></span></div>
</td>
<td class="x_ms-rteTableOddCol-clear" colspan="1" style="border-collapse:collapse; width:23px; border:1px solid transparent">
<br>
</td>
<td class="x_ms-rteTableEvenCol-clear" align="right" style="border-collapse:collapse; width:188px; border:1px solid transparent">
<img class="x_EmojiInsert" src="cid:25912ed8-c5af-43d7-91a2-e73cc3597829"><br>
</td>
</tr>
<tr class="x_ms-rteTableOddRow-clear" style="border-collapse:collapse; border:1px solid transparent; background-color:rgba(255,255,255,0.85)">
<td class="x_ms-rteTableEvenCol-clear" style="border-collapse:collapse; border:1px solid transparent">
<br>
</td>
<td class="x_ms-rteTableOddCol-clear" colspan="1" style="border-collapse:collapse; border:1px solid transparent">
<br>
</td>
<td class="x_ms-rteTableEvenCol-clear" style="border-collapse:collapse; border:1px solid transparent">
<br>
</td>
</tr>
<tr class="x_ms-rteTableEvenRow-clear" style="border-collapse:collapse; border:1px solid transparent; background-color:rgba(255,255,255,0.85)">
<td class="x_ms-rteTableEvenCol-clear" style="border-collapse:collapse; border:1px solid transparent">
<div><span style="color:rgb(117,123,128)">THALES SERVICES SAS</span><br>
<span style="color:rgb(117,123,128)">44 Quai Charles de Gaulle</span><br>
<span style="color:rgb(117,123,128)">CS 20100</span><br>
<span style="color:rgb(117,123,128)">69463 Lyon Cedex 06</span></div>
</td>
<td class="x_ms-rteTableOddCol-clear" colspan="1" style="border-collapse:collapse; border:1px solid transparent">
<br>
</td>
<td class="x_ms-rteTableEvenCol-clear" style="border-collapse:collapse; border:1px solid transparent">
<br>
</td>
</tr>
</tbody>
</table>
<span style="font-size:8pt; color:rgb(117,123,128)">--------------------------------------------------<br>
<a href="http://www.thalesgroup.com" class="x_OWAAutoLink" id="LPNoLP">www.thalesgroup.com</a><br>
</span><i></i>
<p></p>
</div>
</div>
</div>
<p style="font-size:8pt; line-height:10pt; font-family:'Cambria','times roman',serif">
This message contains confidential information and is intended only for the individual(s) addressed in the message. If you are not the named addressee, you should not disseminate, distribute, or copy this e-mail. If you are not the intended recipient, you are
 notified that disclosing, distributing, or copying this e-mail is strictly prohibited.
</p>
</div>
</div>
<p style="font-size:8pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">
This message contains confidential information and is intended only for the individual(s) addressed in the message. If you are not the named addressee, you should not disseminate, distribute, or copy this e-mail. If you are not the intended recipient, you are
 notified that disclosing, distributing, or copying this e-mail is strictly prohibited.
</p>
</body>
</html>