[midPoint] Scripted Hook v4.0 createModificationAdd missing

Pavol Mederly mederly at evolveum.com
Fri Oct 18 21:06:23 CEST 2019


Hello Keith,


yes, I'll be glad to do that. The deltas have been traditionally created 
using ContainerDelta.xyz methods, now migrated to 
prismContext.deltaFactory().container().xyz methods almost in 1:1 way. 
This is what Nico has used. This API is fully functional, but - in my 
opinion - quite complicated.


Therefore, about 4 years ago, the /delta builder/ was created as a 
simple yet powerful mechanism for easy creation of deltas - both object 
deltas and item deltas. It uses a fluent API to construct them, like


prismContext.deltaFor(CaseType.class)
.item(CaseType.F_STATE).replace(SchemaConstants.CASE_STATE_CLOSED)
.item(CaseType.F_CLOSE_TIMESTAMP).replace(now)
                 .asItemDeltas()


There are numerous examples of this API throughout midPoint source code: 
about 360 usages in production code and about 260 usages in test code. 
But I am afraid I still didn't had the time to write a documentation. 
Anyway, I am quite sure the interface is really self-explanatory and simple.


In midPoint 4.0 the interface of obtaining the delta builder was 
slightly changed from (e.g.) |DeltaBuilder.deltaFor(UserType.class, 
prismContext)| to |prismContext.deltaFor(UserType.class)|; however, the 
rest of API is still the same.


As the comparison of these two is concerned, I think the delta builder 
is the way to go in 99 percent of cases. Maybe if you'd need something 
really high-performant (squeezing out fractions of microseconds, 
figurately speaking), you could go for the original way.


Maybe someone could supplement or correct me :)


(Well, actually, we'd be grateful for any comments of both delta and 
query builder API; or midPoint internal APIs in general.)


Best regards and nice weekend!

Pavol Mederly
Software developer
evolveum.com

On 18.10.2019 18:16, Keith Hazelton wrote:
> Could someone at Evolveum send a few sentences to the list about 
> problems for which the Prism construct is the best solution? Are there 
> any caveats about its use?
>
>            Regards,  Keith (hazelton at internet2.edu)
> ------------------------------------------------------------------------
> *From:* Keith Hazelton <keith.hazelton at wisc.edu>
> *Sent:* Friday, October 18, 2019 12:24 AM
> *To:* Keith Hazelton <hazelton at internet2.edu>
> *Subject:* FW: [midPoint] Scripted Hook v4.0 createModificationAdd 
> missing
> *
> *
> ------------------------------------------------------------------------
> *From:* midPointOn Behalf OfNico
> *Sent:* Friday, October 18, 2019 12:23:35 AM (UTC-06:00) Central Time 
> (US & Canada)
> *To:* midPoint General Discussion
> *Subject:* Re: [midPoint] Scripted Hook v4.0 createModificationAdd missing
>
> Hi Pavol,
> thanks for the link. I have get it working now.
> This is what i changed:
> Old pre v4.0:
> assignmentDelta = 
> ContainerDelta.createModificationAdd(UserType.F_ASSIGNMENT, UserType, 
> prismContext, assignment);
> New:
> assignmentDelta = 
> prismContext.deltaFactory().container().createModificationAdd(UserType.F_ASSIGNMENT, 
> UserType,assignment)
>
> Kind regards
> Nico Pätzelt
>
> Am Do., 17. Okt. 2019 um 10:59 Uhr schrieb Pavol Mederly 
> <mederly at evolveum.com <mailto:mederly at evolveum.com>>:
>
>     Hello Nico,
>
>     you're right. The wiki should be (eventually) updated.
>
>     In the meanwhile please see
>     https://wiki.evolveum.com/display/midPoint/Prism+API+migration+notes.
>     For delta creation, the delta builder is the correct way to go.
>
>     Best regards,
>
>     Pavol Mederly
>     Software developer
>     evolveum.com  <http://evolveum.com>
>
>     On 16.10.2019 13:29, Nico wrote:
>>     Hello,
>>
>>     i have updated our midpoint testsystem from 3.8 to 3.9 and now to
>>     4.0.
>>     And now i have an error occurs in the scripted hook section.
>>
>>     I have looked up the example:
>>     https://wiki.evolveum.com/display/midPoint/Scripting+Hooks
>>
>>     Here it says:
>>     |||assignmentDelta =
>>     ContainerDelta.createModificationAdd(UserType.F_ASSIGNMENT,
>>     UserType.class, prismContext, assignment);|
>>     |modelContext.getFocusContext().swallowToPrimaryDelta(assignmentDelta);|
>>     |
>>     |
>>     |This is not working anymore in 4.0. I checked the docs at
>>     https://evolveum.com/downloads/midpoint/4.0/midpoint-api-4.0-javadoc/com/evolveum/midpoint/prism/delta/ContainerDelta.html
>>
>>     |
>>     |but the method createModificationAdd is missing.|
>>     |
>>     |
>>     |So i can't get it running. Maybe someone can give me a tipp? The
>>     wiki article need's to be updated too i think.|
>>     |
>>     |
>>     |Kind regards
>>     |
>>     |Nico Pätzelt
>>     |
>>     |
>>     |
>>     |
>>     |
>>
>>     _______________________________________________
>>     midPoint mailing list
>>     midPoint at lists.evolveum.com  <mailto:midPoint at lists.evolveum.com>
>>     http://lists.evolveum.com/mailman/listinfo/midpoint
>     _______________________________________________
>     midPoint mailing list
>     midPoint at lists.evolveum.com <mailto:midPoint at lists.evolveum.com>
>     http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
> _______________________________________________
> 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/20191018/7e5849a4/attachment.htm>


More information about the midPoint mailing list