[midPoint] Custom Event - notificationManager

Pavol Mederly mederly at evolveum.com
Thu Apr 19 10:24:14 CEST 2018


Hello,


this is exactly what I wanted to write (but had no time). :)


It is a hack, but it works. I know of no other way, besides using 
standard Spring classes (which are probably more complicated).

Pavol Mederly
Software developer
evolveum.com

On 19.04.2018 9:04, Sylvaire kevin TIPA wrote:
>
> reply to myself, the notification manager can be get by :
>
> import 
> com.evolveum.midpoint.wf.impl.processes.common.SpringApplicationContextHolder
> NotificationManager notificationManager = 
> SpringApplicationContextHolder.getBean("notificationManagerImpl", 
> NotificationManager.class)
>
>
> I'm not sure that is the right way ... by it work
>
>
>
> Cordialement.
>
>
> *Sylvaire-Kevin TIPA*
> /Thales Services / OIC INFRAS
> //Devops Infrastructure Automation/
> 	
> 	
>
> 	
> 	
> THALES SERVICES SAS
> 44 Quai Charles de Gaulle
> CS 20100
> 69463 Lyon Cedex 06
> 	
> 	
>
> --------------------------------------------------
> www.thalesgroup.com <http://www.thalesgroup.com>
> ------------------------------------------------------------------------
> *De :* midPoint <midpoint-bounces at lists.evolveum.com> de la part de 
> Sylvaire kevin TIPA <sylvaire-kevin.tipa at mythalesgroup.io>
> *Envoyé :* mercredi 18 avril 2018 16:20:44
> *À :* midpoint at lists.evolveum.com
> *Objet :* [midPoint] Custom Event - notificationManager
>
> 	
> 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’usurpation 
> d’identités <http://aka.ms/LearnAboutSpoofing>
> 	Votre avis <http://aka.ms/SafetyTipsFeedback>
>
> Hello,
>
>
> I try (so hard) to generate custom event in Java, but I get a NULL 
> pointer exception each time...
>
>
> Follow the documentation, we just have this information :
>
> |Event event = ||new| |CustomEvent(lightweightIdentifierGenerator, 
> subtype, handler, item, operation, status, channel);|
> |notificationManager.processEvent(event, task, result);|
>
>
> So I create a custom Event correctly (I think) but the process event 
> always fail ... I'm not sure about "How I can get 
> |notificationManager| object"...
>
>
> I work in Hook in userType / primary. Anyone know how to generate 
> custom event ?
>
>
> See my code :
>
>
> NotificationManager notificationManager = new 
> NotificationManagerImpl() //Probably wrong !
>
> Event event = new CustomEvent(lightweightIdentifierGenerator, 
> "CustomUserRegistrationNotifier", null, user, EventOperationType.ADD, 
> EventStatusType.SUCCESS, null);
>
> notificationManager.processEvent(event)
>
>
>
>
> Here the log :
>
> Caused by: java.lang.NullPointerException: null
>         at 
> com.evolveum.midpoint.notifications.impl.NotificationManagerImpl.processEvent(NotificationManagerImpl.java:102)
> My event object :
>
> >>>event  CustomEvent
>     id: 1524061049969-0-1
>     requester: null
>     requestee: null
>     subtype: CustomUserRegistrationNotifier
>
>
> According to the error log, the source code with problem is in 
> https://github.com/Evolveum/midpoint/blob/80956776707531988908314f7dc1ef47a1e9b25b/model/notifications-impl/src/main/java/com/evolveum/midpoint/notifications/impl/NotificationManagerImpl.java 
> ligne 102 :
>
> <https://github.com/Evolveum/midpoint/blob/80956776707531988908314f7dc1ef47a1e9b25b/model/notifications-impl/src/main/java/com/evolveum/midpoint/notifications/impl/NotificationManagerImpl.java>
> 	
> Evolveum/midpoint 
> <https://github.com/Evolveum/midpoint/blob/80956776707531988908314f7dc1ef47a1e9b25b/model/notifications-impl/src/main/java/com/evolveum/midpoint/notifications/impl/NotificationManagerImpl.java>
> github.com
> midpoint - MidPoint Identity Manager
>
>
> Task task = taskManager.createTaskInstance(OPERATION_PROCESS_EVENT);
>
> MP : 3.6
>
>
>
> Cordialement.
>
>
> *Sylvaire-Kevin TIPA*
> /Thales Services / OIC INFRAS
> //Devops Infrastructure Automation/
> 	
> 	
>
> 	
> 	
> THALES SERVICES SAS
> 44 Quai Charles de Gaulle
> CS 20100
> 69463 Lyon Cedex 06
> 	
> 	
>
> --------------------------------------------------
> www.thalesgroup.com <http://www.thalesgroup.com>
>
> 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.
>
> 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.
>
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20180419/c6c16192/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-cosxwd0w.png
Type: image/png
Size: 6112 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20180419/c6c16192/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-mubeirnh.png
Type: image/png
Size: 6112 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20180419/c6c16192/attachment-0001.png>


More information about the midPoint mailing list