[midPoint] REST API - Search a shadow with specified name in a resource
Wojciech Staszewski
wojciech.staszewski at diagnostyka.pl
Mon Oct 29 18:36:16 CET 2018
Hi Nicolas!
I gave up.
This query gives me what I want and lasts a lot faster:
select oid from m_shadow where name_orig = 'JACK'
and resourceRef_targetOid = '11111111-1111-0000-0000-000000000001'
and objectClass like '%AccountObjectClass';
Duration / Fetch: 0,080 sec / 0,000010 sec
Regards,
WS
W dniu 29.10.2018 o 16:13, Nicolas Rossi pisze:
> Hi Wojciech, I had the same issue some days ago. You should search by
> the shadow attributes values, not the name. Here you have an example
> doing this query by code:
>
>
> *queryAttr = new
> QName("http://midpoint.evolveum.com/xml/ns/public/resource/instance-3",
> "email"*);
>
> propDef = new PrismPropertyDefinitionImpl(queryAttr,
> DOMUtil.XSD_STRING, midpoint.getPrismContext());
>
> objectClass = new
> QName("http://midpoint.evolveum.com/xml/ns/public/resource/instance-3",
> "AccountObjectClass");
>
>
>
> userInMPQuery = QueryBuilder.queryFor(ShadowType.class,
> midpoint.getPrismContext())
>
>
> .item(ShadowType.F_OBJECT_CLASS).eq(objectClass).and()
>
>
> .item(ShadowType.F_RESOURCE_REF).ref("b94e875e-0fc4-4937-8ab8-0998110f0dfa").and()
>
> .itemWithDef(propDef,
> *ShadowType.F_ATTRIBUTES, propDef.getName()*).eq(name.toString())
>
> .build();
>
>
> I'll try to run it with the Query Playground to share with you the
> example.
>
> Regards,
>
>
>
> Ing Nicolás Rossi
> Identicum S.A.
> Jorge Newbery 3226
> Oficina: +54 (11) 4552-3050
> Móvil: +54 (911) 6041-3920
> www.identicum.com <http://www.identicum.com>
>
>
> On Mon, Oct 29, 2018 at 11:52 AM Wojciech Staszewski
> <wojciech.staszewski at diagnostyka.pl
> <mailto:wojciech.staszewski at diagnostyka.pl>> wrote:
>
> Hi,
>
> I'm trying to write a query for REST API, that search a resource
> for a shadow with specified name.
> Based on some examples I wrote something like this:
>
> <?xml version="1.0"?>
> <q:query xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3">
> <q:filter>
> <q:and>
> <q:ref>
> <q:path>resourceRef</q:path>
> <q:value>
> <oid>11111111-1111-0000-0000-000000000001</oid>
> </q:value>
> </q:ref>
> <q:equal>
> <q:path>name</q:path>
> <q:value>JACK</q:value>
> </q:equal>
> <q:equal>
> <q:path>objectClass</q:path>
> <q:value
> xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">ri:AccountObjectClass</q:value>
> </q:equal>
> </q:and>
> </q:filter>
> </q:query>
>
> But it doesn't work. The error is:
> "Cannot combine on-resource and off-resource properties in a
> shadow search query. Encountered property name."
>
> But the query works in "Query playground" (the objectClass part is
> missing, all the rest is the same as above):
> <query>
> <filter>
> <and>
> <ref>
> <path>resourceRef</path>
> <value oid="11111111-1111-0000-0000-000000000001"/>
> </ref>
> <equal>
> <path>name</path>
> <value>JACK</value>
> </equal>
> </and>
> </filter>
> </query>
>
> Do you know how to fix it and make this work?
>
> Thanks!
> WS
>
> --
> Wojciech Staszewski
> Administrator Systemów Sieciowych
> www.diagnostyka.pl <http://www.diagnostyka.pl>
> Diagnostyka Sp. z o. o.
> ul. Prof. M. Życzkowskiego 16, 31-864 Kraków
> Numer KRS: 0000381559 (Sąd Rejonowy dla Krakowa-Śródmieścia w
> Krakowie, XI Wydział Gospodarczy KRS)
> NIP: 675-12-65-009; REGON: 356366975
> Kapitał zakładowy: 33 756 500 zł.
>
> Pomyśl o środowisku zanim wydrukujesz ten e-mail.
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com <mailto:midPoint at lists.evolveum.com>
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
--
Wojciech Staszewski
Administrator Systemów Sieciowych
tel. kom: 663 680 236
www.diagnostyka.pl
Diagnostyka Sp. z o. o.
ul. Prof. M. Życzkowskiego 16, 31-864 Kraków
Numer KRS: 0000381559 (Sąd Rejonowy dla Krakowa-Śródmieścia w Krakowie, XI Wydział Gospodarczy KRS)
NIP: 675-12-65-009; REGON: 356366975
Kapitał zakładowy: 33 756 500 zł.
Pomyśl o środowisku zanim wydrukujesz ten e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20181029/bdab5ca1/attachment.htm>
More information about the midPoint
mailing list