<div dir="ltr"><div dir="ltr"><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif">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:</font></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default">
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:"SF Mono""><b>queryAttr = new QName("<a href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">http://midpoint.evolveum.com/xml/ns/public/resource/instance-3</a>", "email"</b>);</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:"SF Mono"">propDef = new PrismPropertyDefinitionImpl(queryAttr, DOMUtil.XSD_STRING, midpoint.getPrismContext());</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:"SF Mono"">objectClass = new QName("<a href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">http://midpoint.evolveum.com/xml/ns/public/resource/instance-3</a>", "AccountObjectClass");</p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:"SF Mono";min-height:13px"><span class="gmail-Apple-converted-space"> </span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:"SF Mono"">userInMPQuery = QueryBuilder.queryFor(ShadowType.class, midpoint.getPrismContext())</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:"SF Mono""><span class="gmail-Apple-converted-space"> </span>.item(ShadowType.F_OBJECT_CLASS).eq(objectClass).and()</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:"SF Mono""><span class="gmail-Apple-converted-space"> </span>.item(ShadowType.F_RESOURCE_REF).ref("b94e875e-0fc4-4937-8ab8-0998110f0dfa").and()</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:"SF Mono""><span class="gmail-Apple-converted-space"> </span>.itemWithDef(propDef, <b>ShadowType.F_ATTRIBUTES, propDef.getName()</b>).eq(name.toString())</p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:"SF Mono""><span class="gmail-Apple-converted-space"> </span>.build();</p></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif">I'll try to run it with the Query Playground to share with you the example.</font></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif">Regards, </font></div><div class="gmail_default"><font color="#073763" face="arial, helvetica, sans-serif"><br></font></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="arial, helvetica, sans-serif"><br><br><font color="#444444">Ing Nicolás Rossi</font><br><font color="#999999">Identicum S.A.</font><br><font color="#999999">Jorge Newbery 3226</font><br><font color="#999999">Oficina: +54 (11) 4552-3050</font></font></div><div dir="ltr"><font face="arial, helvetica, sans-serif"><font color="#999999">Móvil: +54 (911) 6041-3920<br><a href="http://www.identicum.com" target="_blank">www.identicum.com</a></font></font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 29, 2018 at 11:52 AM Wojciech Staszewski <<a href="mailto:wojciech.staszewski@diagnostyka.pl">wojciech.staszewski@diagnostyka.pl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm trying to write a query for REST API, that search a resource for a shadow with specified name.<br>
Based on some examples I wrote something like this:<br>
<br>
<?xml version="1.0"?><br>
<q:query xmlns:q="<a href="http://prism.evolveum.com/xml/ns/public/query-3" rel="noreferrer" target="_blank">http://prism.evolveum.com/xml/ns/public/query-3</a>"><br>
<q:filter><br>
<q:and><br>
<q:ref><br>
<q:path>resourceRef</q:path><br>
<q:value><br>
<oid>11111111-1111-0000-0000-000000000001</oid><br>
</q:value><br>
</q:ref><br>
<q:equal><br>
<q:path>name</q:path><br>
<q:value>JACK</q:value><br>
</q:equal><br>
<q:equal><br>
<q:path>objectClass</q:path><br>
<q:value xmlns:ri="<a href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" rel="noreferrer" target="_blank">http://midpoint.evolveum.com/xml/ns/public/resource/instance-3</a>">ri:AccountObjectClass</q:value><br>
</q:equal><br>
</q:and><br>
</q:filter><br>
</q:query><br>
<br>
But it doesn't work. The error is:<br>
"Cannot combine on-resource and off-resource properties in a shadow search query. Encountered property name."<br>
<br>
But the query works in "Query playground" (the objectClass part is missing, all the rest is the same as above):<br>
<query><br>
<filter><br>
<and><br>
<ref><br>
<path>resourceRef</path><br>
<value oid="11111111-1111-0000-0000-000000000001"/><br>
</ref><br>
<equal><br>
<path>name</path><br>
<value>JACK</value><br>
</equal><br>
</and><br>
</filter><br>
</query><br>
<br>
Do you know how to fix it and make this work?<br>
<br>
Thanks!<br>
WS<br>
<br>
-- <br>
Wojciech Staszewski<br>
Administrator Systemów Sieciowych<br>
<a href="http://www.diagnostyka.pl" rel="noreferrer" target="_blank">www.diagnostyka.pl</a><br>
Diagnostyka Sp. z o. o.<br>
ul. Prof. M. Życzkowskiego 16, 31-864 Kraków<br>
Numer KRS: 0000381559 (Sąd Rejonowy dla Krakowa-Śródmieścia w Krakowie, XI Wydział Gospodarczy KRS)<br>
NIP: 675-12-65-009; REGON: 356366975<br>
Kapitał zakładowy: 33 756 500 zł.<br>
<br>
Pomyśl o środowisku zanim wydrukujesz ten e-mail.<br>
_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" rel="noreferrer" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
</blockquote></div>