[midPoint] How to create delta for extension properties?
Jan Vaňáček - AMI Praha a.s.
jan.vanacek at ami.cz
Fri May 31 07:19:33 CEST 2019
Here is an example of deleting extension property:
branchValue = basic.getExtensionPropertyValue(input, '
http://mhmp.cz/xml/ns/midpoint/schema/extension-3' , 'branch');
modifyTypeDelta =
ObjectDelta.createModificationDeleteProperty(UserType.class, input.oid, new
ItemPath(new ItemPath(PrismConstants.EXTENSION_LOCAL_NAME),new QName('
http://mhmp.cz/xml/ns/midpoint/schema/extension-3', 'branch')),
midpoint.getPrismContext(), branchValue);
midpoint.executeChanges(modifyTypeDelta);
Just use your correct extension namespace.
JAVA
*From:* midPoint <midpoint-bounces at lists.evolveum.com> *On Behalf Of *Alcides
Carlos de Moraes Neto
*Sent:* Thursday, May 30, 2019 10:09 PM
*To:* midpoint <midpoint at lists.evolveum.com>
*Subject:* [midPoint] How to create delta for extension properties?
Hello list,
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
1)
def delta = DeltaBuilder.deltaFor(UserType.class, prismContext)
.item("nickName").replace(new PolyString(alias))
.item("extension/aliasEmail").delete(alias)
.asObjectDelta(input.oid);
midpoint.modifyObject(delta);
2)
def delta = DeltaBuilder.deltaFor(UserType.class, prismContext)
.item("nickName").replace(new PolyString(alias))
.asObjectDelta(input.oid);
delta.addModification(DeltaBuilder.deltaFor(ExtensionType.class,
prismContext).item("aliasEmail")
.delete(alias).asItemDelta());
midpoint.modifyObject(delta);
The exception:
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20190531/1656db27/attachment.htm>
More information about the midPoint
mailing list