<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Hi Sebastien<br></div><div><br data-mce-bogus="1"></div><div>There is a couple of options, depending on the script you are in, so you may try them one by one:<br data-mce-bogus="1"></div><div>- sometimes <strong>prismContext</strong> is available in the script directly,<br data-mce-bogus="1"></div><div>- typically, <strong>midpoint</strong> is available, which provides <strong>PrismContext</strong> via property: <strong>midpoint.prismContext.deltaFor(...</strong> etc.<br data-mce-bogus="1"></div><div>- in an unlikely situation that these two method above do not work, you can go extreme with PrismContext.get(), but the examples above are definitely more idiomatic in scripts<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Cheers<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Richard Richter<br data-mce-bogus="1"></div><div>Evolveum<br data-mce-bogus="1"></div><div>midPoint Developer<br data-mce-bogus="1"></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><b>From: </b>"midPoint General Discussion" <midpoint@lists.evolveum.com><br><b>To: </b>"midPoint General Discussion" <midpoint@lists.evolveum.com><br><b>Cc: </b>"Sébastien MARBRIER" <smarbrier@positivethinking.tech><br><b>Sent: </b>Friday, January 14, 2022 2:02:50 PM<br><b>Subject: </b>[midPoint] [Midpoint 4.4] Prism API change broke my script.<br></div><div><br><style>/*<![CDATA[*/p.MsoNormal, li.MsoNormal, div.MsoNormal {
        margin: 0.0cm;
        font-size: 11.0pt;
        font-family: Calibri , sans-serif;
}
a:link, span.MsoHyperlink {
        color: rgb(5,99,193);
        text-decoration: underline;
}
a:visited, span.MsoHyperlinkFollowed {
        color: rgb(149,79,114);
        text-decoration: underline;
}
span.EmailStyle17 {
        font-family: Calibri , sans-serif;
        color: windowtext;
}
*.MsoChpDefault {
        font-family: Calibri , sans-serif;
}
div.WordSection1 {
        page: WordSection1;
}
/*]]>*/</style></div><div data-marker="__QUOTED_TEXT__">
<div class="WordSection1">
<p class="MsoNormal">Hello,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span lang="EN-US">In previous releases of midpoint, I was able to retrieve an ItenDelta this way:</span></p>
<p class="MsoNormal"><span lang="EN-US">deltaItem= modelContext.getPrismContext().deltaFor(UserType.class).item(PrismConstants.EXTENSION_LOCAL_NAME, dateAcceptationCharteName).add(mydate).asItemDelta();</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Unfortunately since midpoint 4.4 the getPrismContext method is no longer into the LensContext class  (<a href="https://evolveum.com/downloads/midpoint/4.0.1/midpoint-4.0.1-javadoc/com/evolveum/midpoint/model/impl/lens/LensContext.html" target="_blank" rel="nofollow noopener noreferrer">https://evolveum.com/downloads/midpoint/4.0.1/midpoint-4.0.1-javadoc/com/evolveum/midpoint/model/impl/lens/LensContext.html</a>)</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">The compiler suggests me to replace the getPrismContext by the GetFocusContext() and after I have done the change, to replace deltaFor by iterator but I am pretty sure it misleads me.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">My idea would be to create an ItemDelta object directly but I do not understand how do it.</span></p>
<p class="MsoNormal"><span lang="EN-US">Can somebody help ?</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks</span></p>
<p class="MsoNormal"> </p>
<table class="MsoNormalTable" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td style="width:141pt;border:none;border-right:solid #ff1738 2.25pt;padding:0cm 7.5pt 0cm 0cm" width="188">
<p class="MsoNormal" style="text-align:right" align="right">
<a href="https://www.positivethinking.tech/" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:12pt;font-family:'times new roman' , serif;color:blue;text-decoration:none"><img style="width:1.7708in;height:0.8229in" id="_x0000_i1031" src="cid:image001.png@01D8094F.38973690" alt="logo" width="170" height="79" border="0"></span></a><span style="font-size:12pt;font-family:'times new roman' , serif"></span></p>
</td><td style="width:7.5pt;padding:0cm 0cm 0cm 0cm" width="10">
<p class="MsoNormal"><span style="font-size:12pt;font-family:'times new roman' , serif"> </span></p>
</td><td style="width:372.75pt;padding:0cm 0cm 0cm 0cm" width="497" valign="top">
<p class="MsoNormal"><b><span style="font-size:10pt;font-family:'tahoma' , sans-serif;color:#ff0044" lang="EN-US">Sébastien Marbrier</span></b><span style="font-size:10pt;font-family:'tahoma' , sans-serif;color:#ff0044" lang="EN-US">
</span><span style="font-size:10pt;font-family:'tahoma' , sans-serif;color:#777777" lang="EN-US"> | Senior IT Consultant<br>
</span><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777"><a href="mailto:smarbrier@positivethinking.tech" target="_blank" rel="nofollow noopener noreferrer"><span style="color:#ff0044" lang="EN-US">smarbrier@positivethinking.tech</span></a></span><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777">
</span><span style="font-size:5pt;font-family:'tahoma' , sans-serif;color:#777777" lang="EN-US"><br>
  </span><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777" lang="EN-US"><br>
Tel. </span><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777"><span style="color:#777777;text-decoration:none">+41 21 601 81 00</span>
</span><span style="font-size:5pt;font-family:'tahoma' , sans-serif;color:#777777"><br>
  </span><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777"></span></p>
<table class="MsoNormalTable" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><a href="https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:12pt;font-family:'times new roman' , serif;color:blue;text-decoration:none"><img style="width:0.2083in;height:0.2083in" id="_x0000_i1030" src="cid:image002.png@01D8094F.38973690" alt="Teams chat" width="20" height="20" border="0"></span></a><span style="font-size:12pt;font-family:'times new roman' , serif"></span></p>
</td><td style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><span style="font-size:12pt;font-family:'times new roman' , serif"><a href="https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777;text-decoration:none"> </span></a>
</span></p>
</td><td style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><span style="font-size:12pt;font-family:'times new roman' , serif"><a href="https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777" lang="EN-US">Chat
 with me on Teams</span></a></span><span style="font-size:12pt;font-family:'times new roman' , serif">
<span lang="EN-US"></span></span></p>
</td></tr></tbody></table>
<p class="MsoNormal"><span style="font-size:1pt;font-family:'tahoma' , sans-serif;color:#777777" lang="EN-US"><br>
  </span><span style="font-size:12pt;font-family:'times new roman' , serif" lang="EN-US"></span></p>
</td></tr><tr><td style="border:none;border-right:solid #ff1738 2.25pt;padding:0cm 7.5pt 0cm 0cm">
<p class="MsoNormal" style="text-align:right" align="right">
<span style="font-size:12pt;font-family:'times new roman' , serif" lang="EN-US"><br>
</span><a href="https://www.linkedin.com/company/the-positive-thinking-company/" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:12pt;font-family:'times new roman' , serif;color:blue;text-decoration:none"><img style="width:0.2083in;height:0.2083in" id="_x0000_i1029" src="cid:image003.png@01D8094F.38973690" alt="LinkedIn" width="20" height="20" border="0"></span></a><span style="font-size:12pt;font-family:'times new roman' , serif"> 
</span><a href="https://www.instagram.com/positivethinkingcompany/" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:12pt;font-family:'times new roman' , serif;color:blue;text-decoration:none"><img style="width:0.2083in;height:0.2083in" id="_x0000_i1028" src="cid:image004.png@01D8094F.38973690" alt="Instagram" width="20" height="20" border="0"></span></a><span style="font-size:12pt;font-family:'times new roman' , serif"> 
</span><a href="https://twitter.com/PTC_Tech" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:12pt;font-family:'times new roman' , serif;color:blue;text-decoration:none"><img style="width:0.2083in;height:0.2083in" id="_x0000_i1027" src="cid:image005.png@01D8094F.38973690" alt="Vimeo" width="20" height="20" border="0"></span></a><span style="font-size:12pt;font-family:'times new roman' , serif"> 
</span><a href="https://youtube.com/channel/UCfaImWa6r0IoZoUYLhbiF7w" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:12pt;font-family:'times new roman' , serif;color:blue;text-decoration:none"><img id="_x0000_i1026" src="cid:image006.png@01D8094F.38973690" alt="Vimeo" border="0"></span></a><span style="font-size:12pt;font-family:'times new roman' , serif"></span></p>
</td><td style="padding:0cm 0cm 0cm 0cm" valign="bottom"></td><td style="padding:0cm 0cm 0cm 0cm" valign="bottom">
<p class="MsoNormal"><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777">Avenue de cour, 135 – 1007 Lausanne<br>
<a href="https://www.positivethinking.tech/" target="_blank" rel="nofollow noopener noreferrer"><span style="color:#ff0044">www.positivethinking.tech</span></a>
<br>
</span><span style="font-size:3.5pt;font-family:'tahoma' , sans-serif;color:#777777"> </span><span style="font-size:12pt;font-family:'times new roman' , serif"></span></p>
</td></tr></tbody></table>
<div class="MsoNormal" style="text-align:center" align="center"><span style="font-size:12pt;font-family:'times new roman' , serif">
<hr width="100%" size="2" align="center">
</span></div>
<p class="MsoNormal"><b><span style="font-size:8pt;font-family:'roboto';color:#ff0044" lang="EN-US">Help save paper, do you really need to print this email?</span></b><span style="font-size:8pt;font-family:'roboto';color:#ff0044" lang="EN-US">
</span><span style="font-size:12pt;font-family:'times new roman' , serif" lang="EN-US"><br>
</span><i><span style="font-size:8pt;font-family:'roboto';color:#777777" lang="EN-US">The content of this email and any attachments are confidential and are intended solely for the person and/or company to whom they are addressed.
 The information may also be legally privileged. No employee or agent is authorized to conclude any binding agreement on behalf of Positive Thinking Company with another party by email without express written confirmation. If you have received this email in
 error, any use, reproduction or dissemination of this transmission is strictly prohibited. If you are not the intended recipient, please immediately notify the sender by return E-mail and delete this message, its attachments and all copies from your system.
 Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions.
</span></i><i><span style="font-size:8pt;font-family:'roboto';color:#777777">Thank you for your cooperation.
<br>
  </span></i></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
</div>
<p></p>
<hr>
<span style="font-size:8px"><em><span style="font-family:'roboto' , 'arial'"><span style="color:#777777">Positive Thinking Company puts security at a high priority in its conduct of business. Therefore, we have put our best efforts into ensuring that this email and
 its attached documents are error and virus-free. Nonetheless, full security of emails/documents cannot be ensured. Therefore, the recipient is responsible for checking the email/documents for threats with its own security measures, prior to opening it. Positive
 Thinking Company does not accept liability for any damage inflicted by using the content of this email/documents. If you are not the intended recipient, please notify the sender and delete this email/document.</span></span></em></span>
<p></p>

<br>_______________________________________________<br>midPoint mailing list<br>midPoint@lists.evolveum.com<br>https://lists.evolveum.com/mailman/listinfo/midpoint<br></div></div></body></html>