<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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@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;}
@font-face
{font-family:"\@DengXian";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@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="EN-AU" link="#0563C1" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Matus,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you for fixing this. I have got the latest code and it works.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">But I am now having trouble getting the lookup table rows. Could you please help with this?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">When running command line, I need to add “include=row” to retrieve lookup table rows data. Not sure if there is something in java that does this.<o:p></o:p></p>
<p class="MsoNormal">curl --user admin:Zisssssssss -X GET <a href="https://host:443/midpoint/ws/rest/lookupTables/b04a994d-ee4f-4c5b-86e7-045e5a5e6af0?include=row">
https://host:443/midpoint/ws/rest/lookupTables/b04a994d-ee4f-4c5b-86e7-045e5a5e6af0?include=row</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My dummy java code below only return size =1 with null values. There are many rows in the Lookup table.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black">
</span><b><span style="font-size:10.0pt;font-family:Consolas;color:#7F0055">public</span></b><span style="font-size:10.0pt;font-family:Consolas;color:black">
</span><b><span style="font-size:10.0pt;font-family:Consolas;color:#7F0055">void</span></b><span style="font-size:10.0pt;font-family:Consolas;color:black"> load<span style="background:#CECCF7">Lookup</span>Table()
</span><b><span style="font-size:10.0pt;font-family:Consolas;color:#7F0055">throws</span></b><span style="font-size:10.0pt;font-family:Consolas;color:black"> Exception {</span><span style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> Service
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">service</span><span style="font-size:10.0pt;font-family:Consolas;color:black"> = getService();</span><span style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> List<LookupTableRowType>
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">lookupTableList</span><span style="font-size:10.0pt;font-family:Consolas;color:black"> =
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">service</span><span style="font-size:10.0pt;font-family:Consolas;color:black">.lookupTables().oid(</span><span style="font-size:10.0pt;font-family:Consolas;color:#2A00FF">"b04a994d-ee4f-4c5b-86e7-045e5a5e6af0"</span><span style="font-size:10.0pt;font-family:Consolas;color:black">).get().getRow();</span><span style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> System.</span><b><i><span style="font-size:10.0pt;font-family:Consolas;color:#0000C0">out</span></i></b><span style="font-size:10.0pt;font-family:Consolas;color:black">.println(</span><span style="font-size:10.0pt;font-family:Consolas;color:#2A00FF">"Lookup
table size:"</span><span style="font-size:10.0pt;font-family:Consolas;color:black"> +
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">lookupTableList</span><span style="font-size:10.0pt;font-family:Consolas;color:black">.size()); //this line retured: Lookup table size:1</span><span style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black">
</span><b><span style="font-size:10.0pt;font-family:Consolas;color:#7F0055">for</span></b><span style="font-size:10.0pt;font-family:Consolas;color:black">(</span><b><span style="font-size:10.0pt;font-family:Consolas;color:#7F0055">int</span></b><span style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">i</span><span style="font-size:10.0pt;font-family:Consolas;color:black">=0;
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">i</span><span style="font-size:10.0pt;font-family:Consolas;color:black"><</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">lookupTableList</span><span style="font-size:10.0pt;font-family:Consolas;color:black">.size();
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">i</span><span style="font-size:10.0pt;font-family:Consolas;color:black">++) {</span><span style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> LookupTableRowType
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">lookupTableRowType</span><span style="font-size:10.0pt;font-family:Consolas;color:black"> =
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">lookupTableList</span><span style="font-size:10.0pt;font-family:Consolas;color:black">.get(</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">i</span><span style="font-size:10.0pt;font-family:Consolas;color:black">);</span><span style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> System.</span><b><i><span style="font-size:10.0pt;font-family:Consolas;color:#0000C0">out</span></i></b><span style="font-size:10.0pt;font-family:Consolas;color:black">.println(</span><span style="font-size:10.0pt;font-family:Consolas;color:#2A00FF">"lookup
key="</span><span style="font-size:10.0pt;font-family:Consolas;color:black"> + </span>
<span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">lookupTableRowType</span><span style="font-size:10.0pt;font-family:Consolas;color:black">.getKey());
</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F5F">//this line returned: lookup key=null</span><span style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> System.</span><b><i><span style="font-size:10.0pt;font-family:Consolas;color:#0000C0">out</span></i></b><span style="font-size:10.0pt;font-family:Consolas;color:black">.println(</span><span style="font-size:10.0pt;font-family:Consolas;color:#2A00FF">"lookup
label="</span><span style="font-size:10.0pt;font-family:Consolas;color:black"> +
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">lookupTableRowType</span><span style="font-size:10.0pt;font-family:Consolas;color:black">.getLabel().getContent().get(0));
</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F5F">//this line threw: NullPointerException</span><span style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> }</span><span style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> }</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you very much!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Kind regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Tao Jiang<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">UNSW IT<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Email: <a href="mailto:t.jiang@unsw.edu.au">
t.jiang@unsw.edu.au</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Phone: </span><span style="font-size:12.0pt;color:#252423;background:#FAFAFA">+61 2 9065 8771<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Matus Macik <matus.macik@evolveum.com>
<br>
<b>Sent:</b> Thursday, 24 February 2022 1:54 AM<br>
<b>To:</b> midPoint General Discussion <midpoint@lists.evolveum.com><br>
<b>Cc:</b> Tao Jiang <t.jiang@unsw.edu.au><br>
<b>Subject:</b> Re: [midPoint] Search look up table using Midpoint Java Rest Client 4.4<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black">Hello,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black">I tried the code snipped and actually it's a bug in the MidPoint Client I was able to reproduce. I have created a Jira issue under <a href="https://jira.evolveum.com/browse/MID-7686">https://jira.evolveum.com/browse/MID-7686</a> and
also already pushed a fix. You should find it on the current master branch of the MidPoint Client project. <o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black">--<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black">Best Regards,<br>
<br>
Matus Macik | Developer and Identity Management Engineer<br>
<a href="mailto:matus.macik@evolveum.com">matus.macik@evolveum.com</a> | <a href="http://www.evolveum.com">
www.evolveum.com</a><br>
Evolveum<o:p></o:p></span></p>
</div>
</div>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black">
<hr size="2" width="100%" align="center" id="zwchr">
</span></div>
<div>
<p class="MsoNormal"><b><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black">From:
</span></b><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black">"midPoint General Discussion" <<a href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a>><br>
<b>To: </b>"midPoint General Discussion" <<a href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a>><br>
<b>Cc: </b>"Tao Jiang" <<a href="mailto:t.jiang@unsw.edu.au">t.jiang@unsw.edu.au</a>><br>
<b>Sent: </b>Monday, February 21, 2022 7:14:05 AM<br>
<b>Subject: </b>[midPoint] Search look up table using Midpoint Java Rest Client 4.4<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Dear Midpoint community,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">I have tried to use Midpoint Java Rest Client (version 4.4) to search Look up table using the code below:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:Consolas;color:#7F0055">public</span></b><span style="font-size:10.0pt;font-family:Consolas;color:black">
</span><b><span style="font-size:10.0pt;font-family:Consolas;color:#7F0055">void</span></b><span style="font-size:10.0pt;font-family:Consolas;color:black"> searchLookupTable()
</span><b><span style="font-size:10.0pt;font-family:Consolas;color:#7F0055">throws</span></b><span style="font-size:10.0pt;font-family:Consolas;color:black"> Exception {</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> Service
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">service</span><span style="font-size:10.0pt;font-family:Consolas;color:black"> = getService();</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> ItemPathType
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">namePath</span><span style="font-size:10.0pt;font-family:Consolas;color:black"> =
</span><b><span style="font-size:10.0pt;font-family:Consolas;color:#7F0055">new</span></b><span style="font-size:10.0pt;font-family:Consolas;color:black"> ItemPathType();</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">namePath</span><span style="font-size:10.0pt;font-family:Consolas;color:black">.setValue(</span><span style="font-size:10.0pt;font-family:Consolas;color:#2A00FF">"name"</span><span style="font-size:10.0pt;font-family:Consolas;color:black">);</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> SearchResult<LookupTableType>
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">result</span><span style="font-size:10.0pt;font-family:Consolas;color:black"> = (SearchResult<LookupTableType>)
</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">service</span><span style="font-size:10.0pt;font-family:Consolas;color:black">.lookupTables().search().queryFor(LookupTableType.</span><b><span style="font-size:10.0pt;font-family:Consolas;color:#7F0055">class</span></b><span style="font-size:10.0pt;font-family:Consolas;color:black">).item(</span><span style="font-size:10.0pt;font-family:Consolas;color:#6A3E3E">namePath</span><span style="font-size:10.0pt;font-family:Consolas;color:black">).eq(</span><span style="font-size:10.0pt;font-family:Consolas;color:#2A00FF">"UAC
Lookup"</span><span style="font-size:10.0pt;font-family:Consolas;color:black">).get();</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> }</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black">The last statement ran into java.lang.NullPointerException.
</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black">I can confirm the “UAC Lookup” look up table exists by execute the following query via curl command.</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"><query xmlns=<a href="http://prism.evolveum.com/xml/ns/public/query-3" target="_blank">http://prism.evolveum.com/xml/ns/public/query-3</a>></span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> <filter></span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> <equal></span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> <path>name</path></span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> <value>UAC Lookup</value></span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> </equal></span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> </filter></span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"></query></span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black">Could anyone tell me what’s wrong with the java code?</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black">Thank you very much in advance!</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Kind regards,</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Tao Jiang</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">UNSW IT</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Email: <a href="mailto:t.jiang@unsw.edu.au" target="_blank">
t.jiang@unsw.edu.au</a></span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Phone: </span><span style="font-size:12.0pt;color:#252423;background:#FAFAFA">+61 2 9065 8771</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black"><br>
_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a><br>
<a href="https://lists.evolveum.com/mailman/listinfo/midpoint">https://lists.evolveum.com/mailman/listinfo/midpoint</a><o:p></o:p></span></p>
</div>
</div>
</div>
</body>
</html>