<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="Generator" content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.gmail-message
        {mso-style-name:gmail-message;}
span.StylE-mailovZprvy19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang="CS" link="#0563C1" vlink="#954F72"><div class="WordSection1"><p class="MsoNormal"><span style="mso-fareast-language:EN-US">Here is an example of deleting extension property:</span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US">                 branchValue = basic.getExtensionPropertyValue(input, '<a href="http://mhmp.cz/xml/ns/midpoint/schema/extension-3">http://mhmp.cz/xml/ns/midpoint/schema/extension-3</a>' , 'branch'); </span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US">                 modifyTypeDelta = ObjectDelta.createModificationDeleteProperty(UserType.class, input.oid, new ItemPath(new ItemPath(PrismConstants.EXTENSION_LOCAL_NAME),new QName('<a href="http://mhmp.cz/xml/ns/midpoint/schema/extension-3">http://mhmp.cz/xml/ns/midpoint/schema/extension-3</a>', 'branch')), midpoint.getPrismContext(), branchValue);</span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US">                 midpoint.executeChanges(modifyTypeDelta);</span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US">Just use your correct extension namespace.</span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US">JAVA</span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span></p><p class="MsoNormal"><b>From:</b> midPoint <<a href="mailto:midpoint-bounces@lists.evolveum.com">midpoint-bounces@lists.evolveum.com</a>> <b>On Behalf Of </b>Alcides Carlos de Moraes Neto<br><b>Sent:</b> Thursday, May 30, 2019 10:09 PM<br><b>To:</b> midpoint <<a href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a>><br><b>Subject:</b> [midPoint] How to create delta for extension properties?</p><p class="MsoNormal"> </p><div><div><p class="MsoNormal">Hello list,</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">I need to check and clear some invalid values in our user extension properties. I have done a bulk action script for this, but I'm failing at creating the delta. I have tried two approaches, but they both fail with an IllegalArgumentException</p></div><div><p class="MsoNormal">1)</p></div><div><div><p class="MsoNormal">def delta = DeltaBuilder.deltaFor(UserType.class, prismContext)<br>                        .item("nickName").replace(new PolyString(alias))</p></div><div><p class="MsoNormal">                        .item("extension/aliasEmail").delete(alias)</p></div><div><p class="MsoNormal">                        .asObjectDelta(input.oid);<br>midpoint.modifyObject(delta);</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">2)</p></div></div><div><p class="MsoNormal">def delta = DeltaBuilder.deltaFor(UserType.class, prismContext)<br>                        .item("nickName").replace(new PolyString(alias))<br>                        .asObjectDelta(input.oid);<br>delta.addModification(DeltaBuilder.deltaFor(ExtensionType.class, prismContext).item("aliasEmail")</p></div><div><p class="MsoNormal">                         .delete(alias).asItemDelta());<br>midpoint.modifyObject(delta);</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">The exception:</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal"><span class="gmail-message">2019-05-30T17:07:23.644 ERROR [com.evolveum.midpoint.model.common.expression.script.ScriptExpression] (http-nio-8080-exec-5) Expression error: java.lang.IllegalArgumentException: Undefined or dynamic path: aliasEmail in: CTD ({.../common/common-3}ExtensionType) in in 'execute-script' action</span></p></div></div></div></body></html>