<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p><br>
    </p>
    <p>this is exactly what I wanted to write (but had no time). :)</p>
    <p><br>
    </p>
    <p>It is a hack, but it works. I know of no other way, besides using
      standard Spring classes (which are probably more complicated). <br>
    </p>
    <pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
</pre>
    <div class="moz-cite-prefix">On 19.04.2018 9:04, Sylvaire kevin TIPA
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:HE1PR0902MB196185BE2F558DF0CD10C84CC1B50@HE1PR0902MB1961.eurprd09.prod.outlook.com">
      <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>
      <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>
        <div>import
com.evolveum.midpoint.wf.impl.processes.common.SpringApplicationContextHolder<span><br>
            NotificationManager notificationManager =
            SpringApplicationContextHolder.getBean("notificationManagerImpl",
            NotificationManager.class)</span></div>
        <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"
              cellspacing="0" cellpadding="0" width="100%" border="1">
              <tbody>
                <tr>
                  <td style="border:medium none; padding:0cm;
                    width:301px" valign="top"><br>
                  </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:part1.8184C343.1C15478E@evolveum.com"><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" moz-do-not-send="true">www.thalesgroup.com</a><br>
            </span>
          </div>
        </div>
      </div>
      <hr style="display:inline-block;width:98%" tabindex="-1">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
          face="Calibri, sans-serif" color="#000000"><b>De :</b>
          midPoint <a class="moz-txt-link-rfc2396E" href="mailto:midpoint-bounces@lists.evolveum.com"><midpoint-bounces@lists.evolveum.com></a> de la
          part de Sylvaire kevin TIPA
          <a class="moz-txt-link-rfc2396E" href="mailto:sylvaire-kevin.tipa@mythalesgroup.io"><sylvaire-kevin.tipa@mythalesgroup.io></a><br>
          <b>Envoyé :</b> mercredi 18 avril 2018 16:20:44<br>
          <b>À :</b> <a class="moz-txt-link-abbreviated" href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a><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"
          style="border:0; display:table; width:100%;
          table-layout:fixed; border-collapse:seperate; float:none"
          cellspacing="0" cellpadding="0" align="left" width="100%"
          border="0">
          <tbody>
            <tr>
              <td cellpadding="7px 2px 7px 2px" style="padding:7px 2px
                7px 2px; background-color:#910A19" valign="middle"
                bgcolor="#910A19" width="1px">
                <br>
              </td>
              <td 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" valign="middle" bgcolor="#FDF2F4"
                width="100%">
                <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"
                    moz-do-not-send="true"> usurpation d’identités</a></div>
              </td>
              <td 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" valign="middle" bgcolor="#FDF2F4"
                align="left" width="75px">
                <a href="http://aka.ms/SafetyTipsFeedback"
                  moz-do-not-send="true">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>
            <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 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></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>
            <p style="margin-top:0; margin-bottom:0"><span></span></p>
            <div>>>>event  CustomEvent<br>
                  id: 1524061049969-0-1<br>
                  requester: null<br>
                  requestee: null<br>
                  subtype: CustomUserRegistrationNotifier</div>
            <br>
            <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"
                  moz-do-not-send="true">https://github.com/Evolveum/midpoint/blob/80956776707531988908314f7dc1ef47a1e9b25b/model/notifications-impl/src/main/java/com/evolveum/midpoint/notifications/impl/NotificationManagerImpl.java</a>
                ligne 102 : </span></p>
            <div id="LPBorder_GT_15240611599080.4927771797040431"
              style="margin-bottom:20px; overflow:auto; width:100%;
              text-indent:0px">
              <table id="LPContainer_15240611599020.5398541411585995"
                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)"
                cellspacing="0">
                <tbody>
                  <tr style="border-spacing:0px" valign="top">
                    <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" moz-do-not-send="true"><img
id="LPThumbnailImageID_15240611599040.7259316360750482"
                            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"
                            moz-do-not-send="true" height="250"
                            width="250"></a></div>
                    </td>
                    <td id="x_TextCell_15240611599040.08718670032233933"
                      colspan="2" style="vertical-align:top;
                      padding:0px; display:table-cell">
                      <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"
                          moz-do-not-send="true">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>
            <p style="margin-top:0; margin-bottom:0"><span></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>
            <br>
            <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" style="width:100.0%;
                  border:none; border-top:solid #00BBDF 3.0pt"
                  cellspacing="0" cellpadding="0" width="100%"
                  border="1">
                  <tbody>
                    <tr>
                      <td style="border:medium none; padding:0cm;
                        width:301px" valign="top"><br>
                      </td>
                    </tr>
                  </tbody>
                </table>
                <table class="x_ms-rteTable-clear"
                  style="border-collapse:collapse; table-layout:fixed;
                  border:1px solid transparent" cellspacing="0">
                  <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"
                        style="border-collapse:collapse; width:188px;
                        border:1px solid transparent" align="right">
                        <img class="x_EmojiInsert"
                          src="cid:part9.7D562D3C.D1356A81@evolveum.com"><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"
                    moz-do-not-send="true">www.thalesgroup.com</a><br>
                </span>
              </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>
      <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>