[midPoint] Search look up table using Midpoint Java Rest Client 4.4

Matus Macik matus.macik at evolveum.com
Thu Feb 24 11:17:24 CET 2022


Hi Tao, 

You just need to add the name of the attribute which should be included as a parameter of the "get()" method. In this case the line of code would look something like this: 

LookupTableType lt = service.lookupTables().oid("b04a994d-ee4f-4c5b-86e7-045e5a5e6af0").get(null, Collections.singletonList("row"), null); 

Hope this helps. 

-- 
Best Regards, 

Matus Macik | Developer and Identity Management Engineer 
matus.macik at evolveum.com | www.evolveum.com 
Evolveum 

From: "Tao Jiang" <t.jiang at unsw.edu.au> 
To: "Matus Macik" <matus.macik at evolveum.com>, "midPoint General Discussion" <midpoint at lists.evolveum.com> 
Sent: Thursday, February 24, 2022 5:47:59 AM 
Subject: RE: [midPoint] Search look up table using Midpoint Java Rest Client 4.4 



Hi Matus, 



Thank you for fixing this. I have got the latest code and it works. 



But I am now having trouble getting the lookup table rows. Could you please help with this? 



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. 

curl --user admin:Zisssssssss -X GET [ https://host/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 ] 



My dummy java code below only return size =1 with null values. There are many rows in the Lookup table. 



public void load Lookup Table() throws Exception { 

Service service = getService(); 

List<LookupTableRowType> lookupTableList = service .lookupTables().oid( "b04a994d-ee4f-4c5b-86e7-045e5a5e6af0" ).get().getRow(); 



System. out .println( "Lookup table size:" + lookupTableList .size()); //this line retured: Lookup table size:1 

for ( int i =0; i < lookupTableList .size(); i ++) { 

LookupTableRowType lookupTableRowType = lookupTableList .get( i ); 

System. out .println( "lookup key=" + lookupTableRowType .getKey()); //this line returned: lookup key=null 

System. out .println( "lookup label=" + lookupTableRowType .getLabel().getContent().get(0)); //this line threw: NullPointerException 



} 



} 



Thank you very much! 




Kind regards, 



Tao Jiang 

UNSW IT 

Email: [ mailto:t.jiang at unsw.edu.au | 
t.jiang at unsw.edu.au ] 

Phone: +61 2 9065 8771 





From: Matus Macik <matus.macik at evolveum.com> 
Sent: Thursday, 24 February 2022 1:54 AM 
To: midPoint General Discussion <midpoint at lists.evolveum.com> 
Cc: Tao Jiang <t.jiang at unsw.edu.au> 
Subject: Re: [midPoint] Search look up table using Midpoint Java Rest Client 4.4 





Hello, 





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 [ https://jira.evolveum.com/browse/MID-7686 | https://jira.evolveum.com/browse/MID-7686 ] and also already pushed a fix. You should find it on the current master branch of the MidPoint Client project. 


-- 


Best Regards, 

Matus Macik | Developer and Identity Management Engineer 
[ mailto:matus.macik at evolveum.com | matus.macik at evolveum.com ] | [ http://www.evolveum.com/ | 
www.evolveum.com ] 
Evolveum 



From: "midPoint General Discussion" < [ mailto:midpoint at lists.evolveum.com | midpoint at lists.evolveum.com ] > 
To: "midPoint General Discussion" < [ mailto:midpoint at lists.evolveum.com | midpoint at lists.evolveum.com ] > 
Cc: "Tao Jiang" < [ mailto:t.jiang at unsw.edu.au | t.jiang at unsw.edu.au ] > 
Sent: Monday, February 21, 2022 7:14:05 AM 
Subject: [midPoint] Search look up table using Midpoint Java Rest Client 4.4 





Dear Midpoint community, 



I have tried to use Midpoint Java Rest Client (version 4.4) to search Look up table using the code below: 



public void searchLookupTable() throws Exception { 

Service service = getService(); 

ItemPathType namePath = new ItemPathType(); 

namePath .setValue( "name" ); 

SearchResult<LookupTableType> result = (SearchResult<LookupTableType>) service .lookupTables().search().queryFor(LookupTableType. class ).item( namePath ).eq( "UAC Lookup" ).get(); 



} 



The last statement ran into java.lang.NullPointerException. 

I can confirm the “UAC Lookup” look up table exists by execute the following query via curl command. 

<query xmlns= [ http://prism.evolveum.com/xml/ns/public/query-3 | http://prism.evolveum.com/xml/ns/public/query-3 ] > 

<filter> 

<equal> 

<path>name</path> 

<value>UAC Lookup</value> 

</equal> 

</filter> 

</query> 



Could anyone tell me what’s wrong with the java code? 



Thank you very much in advance! 



Kind regards, 



Tao Jiang 

UNSW IT 

Email: [ mailto:t.jiang at unsw.edu.au | 
t.jiang at unsw.edu.au ] 

Phone: +61 2 9065 8771 




_______________________________________________ 
midPoint mailing list 
[ mailto:midPoint at lists.evolveum.com | midPoint at lists.evolveum.com ] 
[ https://lists.evolveum.com/mailman/listinfo/midpoint | https://lists.evolveum.com/mailman/listinfo/midpoint ] 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220224/7bd46aa6/attachment-0001.htm>


More information about the midPoint mailing list