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

Tao Jiang t.jiang at unsw.edu.au
Thu Feb 24 05:47:59 CET 2022


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: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 loadLookupTable() 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: t.jiang at unsw.edu.au<mailto: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 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
matus.macik at evolveum.com<mailto:matus.macik at evolveum.com> | www.evolveum.com<http://www.evolveum.com>
Evolveum
________________________________
From: "midPoint General Discussion" <midpoint at lists.evolveum.com<mailto:midpoint at lists.evolveum.com>>
To: "midPoint General Discussion" <midpoint at lists.evolveum.com<mailto:midpoint at lists.evolveum.com>>
Cc: "Tao Jiang" <t.jiang at unsw.edu.au<mailto: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>
    <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: t.jiang at unsw.edu.au<mailto:t.jiang at unsw.edu.au>
Phone: +61 2 9065 8771


_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>
https://lists.evolveum.com/mailman/listinfo/midpoint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220224/ff5a9545/attachment-0001.htm>


More information about the midPoint mailing list