MidPoint Script Library

Last modified 07 Mar 2023 11:29 +01:00

MidPoint function library provides access to midPoint internals. It provides complex functions that contain IDM-specific and midPoint-specific logic. It also contains version of IDM Model Interface methods that are designed to be easy to use from the scripting languages.

IDM Model Interface Functions

Following functions directly invoke the operations of IDM Model Interface.The library provides a simplified versions of the operations which are easier to use from scripts. The library implementation automatically supplies some required arguments (such as task and result), provide automatic type conversion and they are also designed to work with the form of prism objects that is typically used in scripts (the JAXB-like compiled form). Therefore use of these functions from scripts is quite seamless.

Function Name Description

getObject(type, oid, [ options ])

Returns object for provided OID. It retrieves the object from an appropriate source for an object type (e.g. internal repository, resource or both), merging data as necessary, processing any policies, caching mechanisms, etc.

searchObjects(type, query, [ options ])
searchObjectsIterative(type, query, handler, [ options ])
searchObjectByName(type, name)

Search for objects. Searches through all object of a specified type. Returns a list of objects that match search criteria. Or invokes the handler (as callback) in the "iterative" version of the methods.

countObjects(type, query)

Count objects. Searches through all object of a specified type and returns a count of such objects.

executeChanges(deltas, [ options ])

Execute the provided object deltas.

addObject(newObject, [ options ])

Add specified object to repository and to the resource (if applicable).

modifyObject(delta, [ options ])

Modify specified object in repository and on the resource (if applicable).

delteObject(type, oid, [ options ])

Delete specified object from the repository and the resource (if applicable).

recompute(type, oid)

Recompute object specified by the OID (and all related projection objects).

findShadowOwner(oid)

Find owner for the specified shadow.

testResource(oid)

Test resource specified by the provided shadow.

You may want to have a look at IDM Model Interface Introduction to see examples how to use these methods. Just keep in mind that the scripting library has a simplified versions of these methods therefore the task and result parameters are supplied automatically and do no need to be specified explicitly.

Examples

<outbound>
    <expression>
        <script>
            <code>
                import com.evolveum.midpoint.xml.ns._public.common.common_2a.*;
                ship = midpoint.getObject(GenericObjectType.class, "54195419-5419-5419-5419-000000000001");
                'The crew of ' + ship.getName();
            </code>
        </script>
    </expression>
</outbound>

JavaDoc and Source Code

Was this page helpful?
YES NO
Thanks for your feedback