[midPoint] MP 3.5 workflouw auto-refuse

Oskar Butovič - AMI Praha a.s. oskar.butovic at ami.cz
Mon Mar 27 10:26:14 CEST 2017


Thanks a lot Pavol!

Those pieces of code are exactly what I need.
I will test it and reply with my results.

Best Regards

Oskar Butovič

2017-03-27 10:10 GMT+02:00 Pavol Mederly <mederly at evolveum.com>:

> Wow! This is a really bright idea.
>
> I think it should be doable (using a couple of dirty hacks, but
> nevertheless, should work reliably).
>
> Basically, you'd need to
>
>    1. obtain a reference to workflowManager bean
>    2. by calling searchContainers with appropriate query you'd obtain the
>    work items for the refuser user
>    3. by iteratively calling completeWorkItem you'd complete (reject) them
>
> Here are some pieces of code that could help you - I'm sorry I have no
> time to try that actually:
>
> ad1 (bean) - there is certainly a nicer way, but I would suggest this:
>
> wfmgr = com.evolveum.midpoint.wf.impl.processes.common.
> SpringApplicationContextHolder.applicationContext.getBean("workflowManager",
> WorkflowManager.class)
>
> ad2 (searchContainers) - something like this
>
> ObjectQuery q = QueryBuilder.queryFor(WorkItemType.class, prismContext)
>                                      .item(WorkItemType.F_ASSIGNEE_
> REF).ref(*refuser OID*)
>                                      .build()
> wfmgr.searchContainers(WorkItemType.class, q, null, result)
>
> ad3 (completion)
>
> let w be the WorkItemType
>
> wfmgr.completeWorkItem(w.workItemId, false, "Automatically rejected ...",
> result)
>
> Hope this helps,
>
> Pavol Mederly
> Software developerevolveum.com
>
> On 27.03.2017 9:55, Oskar Butovič - AMI Praha a.s. wrote:
>
> Hello Pavol,
>
> thanks for your advice. I would prefer to avoid changes in midpoint code
> especially when next version solves the issue perfectly.
>
> Would it be possible to refuse all workflows on certain user (default
> refuser) by bulk task?
>
> Best Regards
>
> Oskar Butovič
>
> 2017-03-27 9:44 GMT+02:00 Pavol Mederly <mederly at evolveum.com>:
>
>> Hello Oskar,
>>
>> I am not sure how to do this. If you throw an exception in
>> approverExpression, then the whole operation fails, a red box will be
>> shown, and no notifications will be sent.
>>
>> You could play with ItemApproval BPMN process, maybe, replacing the
>> original version using an overlay.
>>
>> Or, you could change com.evolveum.midpoint.wf.impl.
>> processes.itemApproval.InitializeLoopThroughApproversInLevel and/or
>> SummarizeDecisionsInLevel to cover the situation when there are no
>> approvers. But be careful, because it's not easy to distinguish between a
>> situation when the item is automatically approved (using an expression) and
>> when there are really no approvers found.
>>
>> Overall, in 3.5 this is not easily done. This hacking could work, but 3.6
>> is much more flexible in this respect.
>>
>> Pavol Mederly
>> Software developerevolveum.com
>>
>> On 27.03.2017 9:21, Oskar Butovič - AMI Praha a.s. wrote:
>>
>> Hello everybody,
>>
>> I am implementing workflow in midpoint 3.5. Under certain conditions (no
>> approver found and for speciffic roles always) I need to refuse assignment
>> outright.
>>
>> I saw outcomeIfNoApprovers planned for 3.6 . Is there any way around it
>> in 3.5? Will refusal notifiacations be sent If i throw exception in an
>> approverExpression?
>>
>> Best Regards
>>
>> Oskar Butovič
>>
>> --
>>
>> Oskar Butovič
>> solution architect
>>
>> gsm: [+420] 774 480 101 <+420%20774%20480%20101>
>> e-mail: oskar.butovic at ami.cz
>>
>>
>> AMI Praha a.s.
>> Pláničkova 11
>> 162 00 Praha 6
>> tel.: [+420] 274 783 239 <+420%20274%20783%20239>
>> web: www.ami.cz
>>
>>
>> [image: AMI Praha a.s.]
>>
>> [image: AMI Praha a.s.]
>> <http://www.ami.cz/reseni-a-sluzby/bezpecnost-dat/identity-management>
>>
>> Textem tohoto e-mailu podepisující neslibuje uzavřít ani neuzavírá za
>> společnost AMI Praha a.s.
>> jakoukoliv smlouvu. Každá smlouva, pokud bude uzavřena, musí mít výhradně
>> písemnou formu.
>>
>>
>>
>> _______________________________________________
>> midPoint mailing listmidPoint at lists.evolveum.comhttp://lists.evolveum.com/mailman/listinfo/midpoint
>>
>> _______________________________________________ midPoint mailing list
>> midPoint at lists.evolveum.com http://lists.evolveum.com/mail
>> man/listinfo/midpoint
>
> --
>
> Oskar Butovič solution architect gsm: [+420] 774 480 101
> <+420%20774%20480%20101> e-mail: oskar.butovic at ami.cz
>
>
> AMI Praha a.s. Pláničkova 11 162 00 Praha 6 tel.: [+420] 274 783 239
> <+420%20274%20783%20239> web: www.ami.cz
>
>
> [image: AMI Praha a.s.]
> [image: AMI Praha a.s.]
> <http://www.ami.cz/reseni-a-sluzby/bezpecnost-dat/identity-management>
> Textem tohoto e-mailu podepisující neslibuje uzavřít ani neuzavírá za
> společnost AMI Praha a.s. jakoukoliv smlouvu. Každá smlouva, pokud bude
> uzavřena, musí mít výhradně písemnou formu.
>
> _______________________________________________
> midPoint mailing listmidPoint at lists.evolveum.comhttp://lists.evolveum.com/mailman/listinfo/midpoint
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>


-- 

Oskar Butovič
solution architect

gsm: [+420] 774 480 101
e-mail: oskar.butovic at ami.cz


AMI Praha a.s.
Pláničkova 11
162 00 Praha 6
tel.: [+420] 274 783 239
web: www.ami.cz


[image: AMI Praha a.s.]

[image: AMI Praha a.s.]
<http://www.ami.cz/reseni-a-sluzby/bezpecnost-dat/identity-management>

Textem tohoto e-mailu podepisující neslibuje uzavřít ani neuzavírá za
společnost AMI Praha a.s.
jakoukoliv smlouvu. Každá smlouva, pokud bude uzavřena, musí mít výhradně
písemnou formu.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170327/e30107e0/attachment.htm>


More information about the midPoint mailing list