<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi Nicolas!</p>
    <p>I gave up.</p>
    <p>This query gives me what I want and lasts a lot faster:</p>
    <p>select oid from m_shadow where name_orig = 'JACK'<br>
      and resourceRef_targetOid = '11111111-1111-0000-0000-000000000001'<br>
      and objectClass like '%AccountObjectClass';</p>
    <p>Duration / Fetch: 0,080 sec / 0,000010 sec<br>
    </p>
    <p>Regards,<br>
      WS<br>
    </p>
    <div class="moz-cite-prefix">W dniu 29.10.2018 o 16:13, Nicolas
      Rossi pisze:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAAxX8cgV-Vz2vRaTEY1as9uFsD8tY2bQ05u6wKT0W0AF_3wsMw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif" color="#073763">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 face="arial, helvetica,
              sans-serif" color="#073763"><br>
            </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif" color="#073763"><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"
                  moz-do-not-send="true">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"
                moz-do-not-send="true">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 face="arial, helvetica,
              sans-serif" color="#073763"><br>
            </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif" color="#073763">I'll try to run it with the
              Query Playground to share with you the example.</font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif" color="#073763"><br>
            </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif" color="#073763">Regards, </font></div>
          <div class="gmail_default"><font face="arial, helvetica,
              sans-serif" color="#073763"><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"
                                                      moz-do-not-send="true">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"
            moz-do-not-send="true">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" moz-do-not-send="true">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" moz-do-not-send="true">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" moz-do-not-send="true">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"
            moz-do-not-send="true">midPoint@lists.evolveum.com</a><br>
          <a href="http://lists.evolveum.com/mailman/listinfo/midpoint"
            rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Wojciech Staszewski
Administrator Systemów Sieciowych
tel. kom: 663 680 236
<a class="moz-txt-link-abbreviated" href="http://www.diagnostyka.pl">www.diagnostyka.pl</a>
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.</pre>
  </body>
</html>