<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Honestly, these builders (delta, query) are very easily used when
writing Java code using automatic completion IDE like Eclipse or
IntelliJ IDEA. <br>
</p>
<p>For writing scripts (except for occasional cases like
newly-prepared IntelliJ IDEA plugin) you unfortunately have to
follow examples or the API code:</p>
<p><br>
</p>
<p><a moz-do-not-send="true"
href="https://github.com/Evolveum/midpoint/blob/master/infra/prism-api/src/main/java/com/evolveum/midpoint/prism/delta/builder/S_ItemEntry.java">https://github.com/Evolveum/midpoint/blob/master/infra/prism-api/src/main/java/com/evolveum/midpoint/prism/delta/builder/S_ItemEntry.java</a></p>
<p><a moz-do-not-send="true"
href="https://github.com/Evolveum/midpoint/blob/master/infra/prism-api/src/main/java/com/evolveum/midpoint/prism/delta/builder/S_ValuesEntry.java">https://github.com/Evolveum/midpoint/blob/master/infra/prism-api/src/main/java/com/evolveum/midpoint/prism/delta/builder/S_ValuesEntry.java</a></p>
<p><a moz-do-not-send="true"
href="https://github.com/Evolveum/midpoint/blob/master/infra/prism-api/src/main/java/com/evolveum/midpoint/prism/delta/builder/S_MaybeDelete.java">https://github.com/Evolveum/midpoint/blob/master/infra/prism-api/src/main/java/com/evolveum/midpoint/prism/delta/builder/S_MaybeDelete.java</a></p>
<p><br>
</p>
<p>Or maybe <br>
</p>
<p><br>
</p>
<p><a moz-do-not-send="true"
href="https://evolveum.com/downloads/downloads/midpoint/4.0/midpoint-api-4.0-javadoc/com/evolveum/midpoint/prism/delta/builder/S_ItemEntry.html">https://evolveum.com/downloads/downloads/midpoint/4.0/midpoint-api-4.0-javadoc/com/evolveum/midpoint/prism/delta/builder/S_ItemEntry.html</a></p>
<p><a moz-do-not-send="true"
href="https://evolveum.com/downloads/downloads/midpoint/4.0/midpoint-api-4.0-javadoc/com/evolveum/midpoint/prism/delta/builder/S_ValuesEntry.html">https://evolveum.com/downloads/downloads/midpoint/4.0/midpoint-api-4.0-javadoc/com/evolveum/midpoint/prism/delta/builder/S_ValuesEntry.html</a></p>
<p><a moz-do-not-send="true"
href="https://evolveum.com/downloads/downloads/midpoint/4.0/midpoint-api-4.0-javadoc/com/evolveum/midpoint/prism/delta/builder/S_MaybeDelete.html">https://evolveum.com/downloads/downloads/midpoint/4.0/midpoint-api-4.0-javadoc/com/evolveum/midpoint/prism/delta/builder/S_MaybeDelete.html</a></p>
<p><br>
</p>
<p>Best regards,<br>
</p>
<pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
</pre>
<div class="moz-cite-prefix">On 18.10.2019 21:06, Pavol Mederly
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:9a0ef1fa-41cc-70cf-4fa3-776a5e101fa0@evolveum.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<p>Hello Keith,</p>
<p><br>
</p>
<p>yes, I'll be glad to do that. The deltas have been
traditionally created using <tt>ContainerDelta.xyz</tt>
methods, now migrated to <tt>prismContext.deltaFactory().container().xyz</tt>
methods almost in 1:1 way. This is what Nico has used. This API
is fully functional, but - in my opinion - quite complicated.</p>
<p><br>
</p>
<p>Therefore, about 4 years ago, the <i>delta builder</i> 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</p>
<p><br>
</p>
<p><tt>prismContext.deltaFor(CaseType.class)</tt><tt><br>
</tt><tt>
.item(CaseType.F_STATE).replace(SchemaConstants.CASE_STATE_CLOSED)</tt><tt><br>
</tt><tt>
.item(CaseType.F_CLOSE_TIMESTAMP).replace(now)</tt><tt><br>
</tt><tt> .asItemDeltas()</tt><tt><br>
</tt></p>
<p><br>
</p>
<p>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.</p>
<p><br>
</p>
<p>In midPoint 4.0 the interface of obtaining the delta builder
was slightly changed from (e.g.) <code>DeltaBuilder.deltaFor(UserType.class,
prismContext)</code> to <code>prismContext.deltaFor(UserType.class)</code>;
however, the rest of API is still the same.<br>
</p>
<p><br>
</p>
<p>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.<br>
</p>
<p><br>
</p>
<p>Maybe someone could supplement or correct me :)</p>
<p><br>
</p>
<p>(Well, actually, we'd be grateful for any comments of both
delta and query builder API; or midPoint internal APIs in
general.)</p>
<p><br>
</p>
<p>Best regards and nice weekend!<br>
</p>
<pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
</pre>
<div class="moz-cite-prefix">On 18.10.2019 18:16, Keith Hazelton
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:SN6PR08MB473455273748CDEA7509BB1C866C0@SN6PR08MB4734.namprd08.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 style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);"> 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?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);"> Regards,
Keith (<a class="moz-txt-link-abbreviated"
href="mailto:hazelton@internet2.edu" moz-do-not-send="true">hazelton@internet2.edu</a>)<br>
</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>From:</b>
Keith Hazelton <a class="moz-txt-link-rfc2396E"
href="mailto:keith.hazelton@wisc.edu"
moz-do-not-send="true"><keith.hazelton@wisc.edu></a><br>
<b>Sent:</b> Friday, October 18, 2019 12:24 AM<br>
<b>To:</b> Keith Hazelton <a class="moz-txt-link-rfc2396E"
href="mailto:hazelton@internet2.edu"
moz-do-not-send="true"><hazelton@internet2.edu></a><br>
<b>Subject:</b> FW: [midPoint] Scripted Hook v4.0
createModificationAdd missing</font>
<div> </div>
</div>
<div><strong>
<div><font size="2" face="Tahoma" color="#000000"> </font></div>
</strong>
<hr tabindex="-1" style="display:inline-block; width:98%"> <font
size="2" face="Tahoma"><b>From:</b> midPointOn Behalf OfNico<br>
<b>Sent:</b> Friday, October 18, 2019 12:23:35 AM
(UTC-06:00) Central Time (US & Canada)<br>
<b>To:</b> midPoint General Discussion<br>
<b>Subject:</b> Re: [midPoint] Scripted Hook v4.0
createModificationAdd missing<br>
</font><br>
<div>
<div dir="ltr">
<div>Hi Pavol,</div>
<div>thanks for the link. I have get it working now.</div>
<div>This is what i changed:</div>
<div>Old pre v4.0:</div>
<div>assignmentDelta =
ContainerDelta.createModificationAdd(UserType.F_ASSIGNMENT,
UserType, prismContext, assignment);</div>
<div>New:</div>
<div>assignmentDelta =
prismContext.deltaFactory().container().createModificationAdd(UserType.F_ASSIGNMENT,
UserType,assignment)</div>
<div><br>
</div>
<div>Kind regards</div>
<div>Nico Pätzelt<br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">Am Do., 17. Okt. 2019
um 10:59 Uhr schrieb Pavol Mederly <<a
href="mailto:mederly@evolveum.com"
moz-do-not-send="true">mederly@evolveum.com</a>>:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px
0px 0.8ex; border-left:1px solid rgb(204,204,204);
padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>Hello Nico,</p>
<p>you're right. The wiki should be (eventually)
updated.<br>
</p>
<p>In the meanwhile please see <a
href="https://wiki.evolveum.com/display/midPoint/Prism+API+migration+notes"
target="_blank" moz-do-not-send="true">
https://wiki.evolveum.com/display/midPoint/Prism+API+migration+notes</a>.
For delta creation, the delta builder is the correct
way to go.</p>
<p>Best regards,<br>
</p>
<pre cols="72">Pavol Mederly
Software developer
<a href="http://evolveum.com" target="_blank" moz-do-not-send="true">evolveum.com</a>
</pre>
<div>On 16.10.2019 13:29, Nico wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Hello,</div>
<div><br>
</div>
<div>i have updated our midpoint testsystem from
3.8 to 3.9 and now to 4.0.</div>
<div>And now i have an error occurs in the
scripted hook section.<br>
</div>
<div>
<div>
<div><br>
</div>
<div>I have looked up the example:<br>
</div>
<div><a
href="https://wiki.evolveum.com/display/midPoint/Scripting+Hooks"
target="_blank" moz-do-not-send="true">https://wiki.evolveum.com/display/midPoint/Scripting+Hooks</a></div>
<div><br>
</div>
<div>Here it says:</div>
<div>
<div><code></code><code>assignmentDelta =
ContainerDelta.createModificationAdd(UserType.F_ASSIGNMENT,
UserType.class, prismContext,
assignment);</code></div>
<div><code>modelContext.getFocusContext().swallowToPrimaryDelta(assignmentDelta);</code></div>
<div><code><br>
</code></div>
<div><code>This is not working anymore in
4.0. I checked the docs at <a
href="https://evolveum.com/downloads/midpoint/4.0/midpoint-api-4.0-javadoc/com/evolveum/midpoint/prism/delta/ContainerDelta.html"
target="_blank" moz-do-not-send="true">
https://evolveum.com/downloads/midpoint/4.0/midpoint-api-4.0-javadoc/com/evolveum/midpoint/prism/delta/ContainerDelta.html</a>
<br>
</code></div>
<div><code>but the method
createModificationAdd is missing.</code></div>
<div><code><br>
</code></div>
<div><code>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.</code></div>
<div><code><br>
</code></div>
<div><code>Kind regards <br>
</code></div>
<div><code>Nico Pätzelt<br>
</code></div>
<div><code><br>
</code></div>
<div><code><br>
</code></div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
midPoint mailing list
<a href="mailto:midPoint@lists.evolveum.com" target="_blank" moz-do-not-send="true">midPoint@lists.evolveum.com</a>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank" moz-do-not-send="true">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
</blockquote>
</div>
_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com"
target="_blank" moz-do-not-send="true">midPoint@lists.evolveum.com</a><br>
<a
href="http://lists.evolveum.com/mailman/listinfo/midpoint"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
</blockquote>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com" moz-do-not-send="true">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint" moz-do-not-send="true">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-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>
</body>
</html>