[midPoint] Query shadows by resource and name
Nicolas Rossi
nrossi at identicum.com
Tue Oct 23 18:38:19 CEST 2018
Hi, we are trying to query the existing shadows to create a unique user
name in midPoint. There is a very useful function called
midpoint.isUniquePropertyValue but it only works for users not for shadows
(I couldn't find the way to make it work).
I tried writing a custom query like that:
objectClass = new QName("
http://midpoint.evolveum.com/xml/ns/public/resource/instance-3",
"AccountObjectClass");
userInMPQuery = QueryBuilder.queryFor(ShadowType.class,
midpoint.getPrismContext())
.item(ShadowType.F_NAME).eqPoly(name.toString()).and()
.item(ShadowType.F_OBJECT_CLASS).eq(objectClass).and()
.item(ShadowType.F_RESOURCE_REF).ref("702ecc89-deba-4542-9618-5b9c8ba94abe")
.build();
It fails with this message:
Caused by: com.evolveum.midpoint.util.exception.SchemaException: *Cannot
combine on-resource and off-resource properties in a shadow search query.
Encountered property name*
at
com.evolveum.midpoint.provisioning.impl.ShadowCache.createAttributeQueryInternal(ShadowCache.java:1756)
at
com.evolveum.midpoint.provisioning.impl.ShadowCache.createAttributeQuery(ShadowCache.java:1711)
at
com.evolveum.midpoint.provisioning.impl.ShadowCache.searchObjectsIterative(ShadowCache.java:1598)
at
com.evolveum.midpoint.provisioning.impl.ShadowCache.searchObjectsIterative(ShadowCache.java:1578)
at
com.evolveum.midpoint.provisioning.impl.ProvisioningServiceImpl.searchObjectsIterative(ProvisioningServiceImpl.java:1000)
at
com.evolveum.midpoint.provisioning.impl.ProvisioningServiceImpl.searchObjects(ProvisioningServiceImpl.java:456)
at
com.evolveum.midpoint.model.impl.controller.ModelController.searchObjects(ModelController.java:789)
at
com.evolveum.midpoint.model.impl.expr.MidpointFunctionsImpl.searchObjects(MidpointFunctionsImpl.java:1060)
at
com.evolveum.midpoint.model.api.expr.MidpointFunctions$searchObjects.call(Unknown
Source)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at Script16.run(Script16.groovy:13)
It's very strange behavior because I can run a similar query on the
Playground and it works fine:
<query>
<filter>
<and>
<ref>
<path>resourceRef</path>
<value oid="702ecc89-deba-4542-9618-5b9c8ba94abe"/>
</ref>
<equal>
<path>name</path>
<value>ealonso</value>
</equal>
</and>
</filter>
</query>
Any help ?
Thanks in advance
Ing Nicolás Rossi
Identicum S.A.
Jorge Newbery 3226
Oficina: +54 (11) 4552-3050
Móvil: +54 (911) 6041-3920
www.identicum.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20181023/56890f45/attachment.htm>
More information about the midPoint
mailing list