[midPoint] Lookuptable synchronization

Peter Holes pholes at gmail.com
Tue Apr 13 22:20:42 CEST 2021


Hello Frederic,

if you have an option to share the lookupTables e.g. as dbtables from your
source, you can enrich your resource with inbounds and synchronize the data
directly into midpoint lookupTable objects, instead of calling the REST API.

I am using this mapping to synchronize organization structure and
populating some values into my own lookupTable. If you add some logic for
update and delete, the lookup table should be self manageable

Here is my piece of inbound mapping:
--snip--
<inbound>
<strength>strong</strength>
<expression>
<script>
<code>
                import
com.evolveum.midpoint.xml.ns._public.common.common_3.*
                import
com.evolveum.prism.xml.ns._public.types_3.PolyStringType
                import com.evolveum.midpoint.schema.GetOperationOptions;
                import
com.evolveum.midpoint.schema.RelationalValueSearchQuery;
                import
com.evolveum.midpoint.schema.RelationalValueSearchType;
                import com.evolveum.midpoint.schema.SelectorOptions;

                import com.evolveum.midpoint.prism.delta.builder.*
                import com.evolveum.midpoint.prism.delta.ObjectDelta;

                import static
com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType.F_ROW;
                import static
com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType.F_NAME;

                prism = midpoint.getPrismContext()
                LookupTableRowType rw = new LookupTableRowType(prism)
                //my custom lookupTable OID
lOid = 'lookupz0-feed-0000-0000-000000000240';

                //generate friendly name
oName = basic.getAttributeValue(shadow, "NAME") + ' ('+ input + ')';
                myLabel = PolyStringType.fromOrig(basic.stringify(oName))

//set-up lookupTable value
oIdentifier = basic.getAttributeValue(shadow, "IDENTIFIER")

                rw.setKey(basic.stringify(oIdentifier));
                rw.setLabel(myLabel);

                modifications =
prismContext.deltaFor(LookupTableType.class).item(F_ROW).add(rw).asObjectDeltas(lOid);
                midpoint.executeChanges(modifications, null);
</code>
</script>
</expression>
<target>
<c:path>description</c:path>
</target>
</inbound>

--snip--
Hope this helps.

Peter.

Sent from Sony Xperia™ smartphone.
Please excuse any typos.

On Tue, Apr 13, 2021 at 12:00 PM <midpoint-request at lists.evolveum.com>
wrote:

> Send midPoint mailing list submissions to
>         midpoint at lists.evolveum.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.evolveum.com/mailman/listinfo/midpoint
> or, via email, send a message with subject or body 'help' to
>         midpoint-request at lists.evolveum.com
>
> You can reach the person managing the list at
>         midpoint-owner at lists.evolveum.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of midPoint digest..."
>
>
> Today's Topics:
>
>    1. Re: Lookuptable synchronization (Slavek Licehammer)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 12 Apr 2021 23:58:17 +0200
> From: Slavek Licehammer <slavek.licehammer at evolveum.com>
> To: midPoint General Discussion <midpoint at lists.evolveum.com>
> Subject: Re: [midPoint] Lookuptable synchronization
> Message-ID: <16339986-a2ab-99b5-c639-ab64995a4330 at evolveum.com>
> Content-Type: text/plain; charset=utf-8
>
> Hello Frederic.
>
> MidPoint is not able to synchronize lookup tables by itself, but you can
> update them using REST API call.
>
> That means you need to generate the lookup table as XML, JSON or YAML file
> and then upload it using REST call like this one:
>
> curl --user administrator:5ecr3t -H "Content-Type: application/xml" -X PUT
> http://localhost:8080/midpoint/ws/rest/lookupTables/d74d9990-3953-11e6-ab88-7fda62960e0f
> -d @lookuptable.xml
>
> Detailed REST API documentation is here:
> https://wiki.evolveum.com/display/midPoint/REST+API
>
> The update can be done in runtime. There is no need for restart or
> anything else.
>
> Best regards,
>
>    Slavek
>
>
> On 17/03/2021 17:05, Frédéric Lohier via midPoint wrote:
> > Hello,
> >
> >
> > We are using several lookup tables as enumeration in the user template
> as described here https://wiki.evolveum.com/display/midPoint/Lookup+Tables
> <https://wiki.evolveum.com/display/midPoint/Lookup+Tables>.
> >
> > The content of some of our lookup tables is managed by another entity.
> For example, the standardized list of employee titles is managed by Human
> Resources.
> >
> > Is it possible to synchronize lookup tables with data coming from a
> third-party system? Is it the best approach for this use case? Do you have
> any example that I can use?
> >
> > -Frederic
> >
> > _______________________________________________
> > midPoint mailing list
> > midPoint at lists.evolveum.com
> > https://lists.evolveum.com/mailman/listinfo/midpoint
> >
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint
>
>
> ------------------------------
>
> End of midPoint Digest, Vol 108, Issue 12
> *****************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20210413/72bfcb15/attachment.htm>


More information about the midPoint mailing list