<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Arial",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="NL-BE" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">Hi guys,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">We are creating our own REST API with a Maven Overlay of midPoint (to limit the chatter over the network). We also have a custom schema for UserType. In our REST
API I need to search for a user based on a value within the extension. <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">In the Query Playground I get a correct result for this query:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"><query><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"> <filter><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"> <equal><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"> <path>extension/briamId</path><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"> <value>33c161e0-ed27-470c-9606-c863894c782b</value><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"> </equal><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"> </filter><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"></query></span><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">Because of that I wanted to replicate this query in Java code:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">EqualFilter<String>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">filter</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"> = EqualFilter.<i>createEqual</i>(</span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7F0055">new</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">
ItemPath(</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#2A00FF">"extension/briamId"</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">),</span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7F0055">null</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">,</span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7F0055">null</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">);</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"> PrismPropertyValue<String>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">value</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"> =
</span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7F0055">new</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"> PrismPropertyValue<String>(</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">briamId</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">);</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">filter</span><span style="font-size:10.0pt;font-family:Consolas;color:black">.setValue(</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">value</span><span style="font-size:10.0pt;font-family:Consolas;color:black">);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black">SearchResultList<PrismObject<UserType>> userPrismList =modelService.searchObjects(UserType.class, ObjectQuery.createObjectQuery(filter) , options, task, parentResult);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">When I execute this code the following exception occurs:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">2017-05-29 16:58:47,375 [] [http-nio-8080-exec-2] ERROR (com.evolveum.midpoint.repo.sql.helpers.BaseHelper): General checked exception occurred.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">com.evolveum.midpoint.repo.sql.query.QueryException: Couldn't find a proper restriction for a ValueFilter: EQUAL:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> PATH: extension/briamId<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> DEF: null<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> VALUE:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> 33c161e0-ed27-470c-9606-c863894c782b<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at com.evolveum.midpoint.repo.sql.query2.QueryInterpreter2.findAndCreateRestrictionInternal(QueryInterpreter2.java:230) ~[repo-sql-impl-3.5.1.jar:na]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at com.evolveum.midpoint.repo.sql.query2.QueryInterpreter2.findAndCreateRestriction(QueryInterpreter2.java:176) ~[repo-sql-impl-3.5.1.jar:na]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at com.evolveum.midpoint.repo.sql.query2.QueryInterpreter2.interpretFilter(QueryInterpreter2.java:156) ~[repo-sql-impl-3.5.1.jar:na]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at com.evolveum.midpoint.repo.sql.query2.QueryInterpreter2.interpretQueryFilter(QueryInterpreter2.java:150) ~[repo-sql-impl-3.5.1.jar:na]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at com.evolveum.midpoint.repo.sql.query2.QueryInterpreter2.interpret(QueryInterpreter2.java:120) ~[repo-sql-impl-3.5.1.jar:na]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at com.evolveum.midpoint.repo.sql.query2.QueryEngine2.interpret(QueryEngine2.java:50) ~[repo-sql-impl-3.5.1.jar:na]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at com.evolveum.midpoint.repo.sql.helpers.ObjectRetriever.searchObjectsAttempt(ObjectRetriever.java:373) ~[repo-sql-impl-3.5.1.jar:na]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at com.evolveum.midpoint.repo.sql.SqlRepositoryServiceImpl.searchObjects(SqlRepositoryServiceImpl.java:251) [repo-sql-impl-3.5.1.jar:na]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at com.evolveum.midpoint.repo.cache.RepositoryCache.searchObjects(RepositoryCache.java:165) [repo-cache-3.5.1.jar:na]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at com.evolveum.midpoint.model.impl.controller.ModelController.searchObjects(ModelController.java:826) [model-impl-3.5.1.jar:na]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at brussels.bric.midpoint.rest.UserService.getUser(UserService.java:104) [briam-midpoint-rest-server-1.0.0.jar:na]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_66]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_66]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_66]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_66]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"> …<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">I have no idea what I’m missing. Any ideas?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">Thanks!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">Glenn<o:p></o:p></span></p>
</div>
<div lang="FR-BE" vlink="#6c606a" link="#005dba">
<div class="WordSection1">
<table border="0">
<tbody>
<tr>
<td style="BORDER-RIGHT: #fecb00 thin solid; WIDTH: 306px" valign="top" width="322">
<img border="0" hspace="0" src="cid:cibg_aee22c14-e9ed-4d7b-8c27-f6c4a26e7736.png" width="300" height="101"></td>
<td valign="top">
<p style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; LINE-HEIGHT: normal"><span class="TitreCar"><b><span lang="EN-US" style="FONT-SIZE: 15pt; FONT-FAMILY: 'Calibri Light','sans-serif'; COLOR: #0080bf">Glenn Boschmans</span></b></span><br>
<span class="MsoSubtleReference"><span lang="EN-US" style="FONT-FAMILY: 'Calibri Light','sans-serif'; COLOR: #0a00be">Consultant</span></span><br>
<span lang="EN-US" style="FONT-SIZE: 11pt; FONT-FAMILY: 'Calibri Light','sans-serif'; COLOR: #164397">Business Integrated Solutions
</span><br>
<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Calibri Light','sans-serif'">Kunstlaan 21, 1000 Brussel -
</span><span lang="EN-US" style="FONT-FAMILY: 'Calibri Light','sans-serif'; COLOR: #0080bf"><a href="http://cibg.brussels"><span style="FONT-SIZE: 10pt; COLOR: #0080bf">cibg.brussels</span></a></span><span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Calibri Light','sans-serif'">
- </span><span lang="EN-US" style="FONT-FAMILY: 'Calibri Light','sans-serif'; COLOR: #0080bf"><a href="http://cibg.brussels/disclaimer-1"><span style="FONT-SIZE: 10pt; COLOR: #0080bf">disclaimer</span></a></span><br>
<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Calibri Light','sans-serif'">+32 2 282 47 70<span style="COLOR: #fecb00"> | </span><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Calibri Light', 'sans-serif'; COLOR: #000000">
<span style="COLOR: #000000"><br>
<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Calibri Light','sans-serif'; COLOR: #61c250">Be green, leave it on the screen !</span>
</span></span><a href="http://www.linkedin.com/company/cirb_cibg"><img border="0" src="cid:ln_e679eb12-caaa-4d0d-b64d-b39c820c309b.png" width="22" height="19"></a> <a href="https://twitter.com/CIRB_CIBG"><img border="0" src="cid:tw_20cfb408-d952-4ea7-a757-a8716eaac012.png" width="19" height="19"></a> <a href="http://www.leefmilieu.brussels/themas/duurzame-stad/label-ecodynamische-onderneming"><img border="0" hspace="0" src="cid:logo_eco_mail_e3e2fbdd-9cbf-4a5b-b0c1-1624e00ef4cd.jpg"></a></span></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>