Package org.forgerock.openam.integration.idm

Class IdmIntegrationServiceScriptWrapper


  • @Supported(scriptingApi=true)
    public class IdmIntegrationServiceScriptWrapper
    extends Object
    A class providing an "openidm" object in JS scripts running within AM, which calls CRUDPAQ endpoints of the configured IDM instance.

    Example usage:

         var user = openidm.read("managed/alpha_user/1234-abcd-5678-efgh")
     
    • Method Detail

      • create

        @Supported(scriptingApi=true)
        public Map<String,​Object> create​(String resourceName,
                                               String newResourceId,
                                               Map<String,​Object> content)
                                        throws ResourceException
        Creates a new object in IDM.
        Parameters:
        resourceName - The resource name of the object to be created. e.g. "managed/user"
        newResourceId - The new ID of the object to be created. Set to 'null' if the server should generate the ID.
        content - The object being created
        Returns:
        The created object
        Throws:
        ResourceException - when object creation fails
      • create

        @Supported(scriptingApi=true)
        public Map<String,​Object> create​(String resourceName,
                                               String newResourceId,
                                               Map<String,​Object> content,
                                               Map<String,​Object> params)
                                        throws ResourceException
        Creates a new object in IDM.
        Parameters:
        resourceName - The resource name of the object to be created. e.g. "managed/user"
        newResourceId - The new ID of the object to be created. Set to 'null' if the server should generate the ID.
        content - The object being created
        params - Additional parameters that are passed to the create request
        Returns:
        The created object
        Throws:
        ResourceException - when object creation fails
      • create

        @Supported(scriptingApi=true)
        public Map<String,​Object> create​(String resourceName,
                                               String newResourceId,
                                               Map<String,​Object> content,
                                               Map<String,​Object> params,
                                               List<Object> fields)
                                        throws ResourceException
        Creates a new object in IDM.
        Parameters:
        resourceName - The resource name of the object to be created. e.g. "managed/user"
        newResourceId - The new ID of the object to be created. Set to 'null' if the server should generate the ID.
        content - The object being created
        params - Additional parameters that are passed to the create request
        fields - An array of the fields that should be returned in the result. The list of fields can include wild cards, such as * or *_ref. If no fields are specified, the entire new object is returned.
        Returns:
        The created object
        Throws:
        ResourceException - when object creation fails
      • read

        @Supported(scriptingApi=true)
        public Map<String,​Object> read​(String resourceName,
                                             Map<String,​Object> params)
                                      throws ResourceException
        Reads and returns a resource object.
        Parameters:
        resourceName - The full path to the object to be read, including the ID.
        params - The parameters that are passed to the read request. Generally, no additional parameters are passed to a read request, but this might differ, depending on the request. If you need to specify a list of fields as a third parameter, and you have no additional params to pass, you must pass null here. Otherwise, you simply omit both parameters.
        Returns:
        The resource object, or null if not found.
        Throws:
        ResourceException - when there was an unexpected error.
      • read

        @Supported(scriptingApi=true)
        public Map<String,​Object> read​(String resourceName,
                                             Map<String,​Object> params,
                                             List<Object> fields)
                                      throws ResourceException
        Reads and returns a resource object.
        Parameters:
        resourceName - The full path to the object to be read, including the ID.
        params - The parameters that are passed to the read request. Generally, no additional parameters are passed to a read request, but this might differ, depending on the request. If you need to specify a list of fields as a third parameter, and you have no additional params to pass, you must pass null here. Otherwise, you simply omit both parameters.
        fields - An array of the fields that should be returned in the result. The list of fields can include wild cards, such as * or *_ref. If no fields are specified, the entire object is returned.
        Returns:
        The resource object, or null if not found.
        Throws:
        ResourceException - when there was an unexpected error.
      • update

        @Supported(scriptingApi=true)
        public Map<String,​Object> update​(String id,
                                               String rev,
                                               Map<String,​Object> value)
                                        throws ResourceException
        Updates an entire resource object.
        Parameters:
        id - The complete path to the object to be updated, including its ID.
        rev - The revision of the object to be updated. Use null if the object is not subject to revision control, or if you want to skip the revision check and update the object, regardless of the revision.
        value - The complete replacement object
        Returns:
        The modified resource object
        Throws:
        ResourceException - when the object cannot be updated
      • update

        @Supported(scriptingApi=true)
        public Map<String,​Object> update​(String id,
                                               String rev,
                                               Map<String,​Object> value,
                                               Map<String,​Object> params)
                                        throws ResourceException
        Updates an entire resource object.
        Parameters:
        id - The complete path to the object to be updated, including its ID.
        rev - The revision of the object to be updated. Use null if the object is not subject to revision control, or if you want to skip the revision check and update the object, regardless of the revision.
        value - The complete replacement object
        params - The parameters that are passed to the update request.
        Returns:
        The modified resource object
        Throws:
        ResourceException - when the object cannot be updated
      • update

        @Supported(scriptingApi=true)
        public Map<String,​Object> update​(String id,
                                               String rev,
                                               Map<String,​Object> value,
                                               Map<String,​Object> params,
                                               List<Object> fields)
                                        throws ResourceException
        Updates an entire resource object.
        Parameters:
        id - The complete path to the object to be updated, including its ID.
        rev - The revision of the object to be updated. Use null if the object is not subject to revision control, or if you want to skip the revision check and update the object, regardless of the revision.
        value - The complete replacement object
        params - The parameters that are passed to the update request.
        fields - An array of the fields that should be returned in the result. The list of fields can include wild cards, such as * or *_ref. If no fields are specified, the entire object is returned.
        Returns:
        The modified resource object
        Throws:
        ResourceException - when the object cannot be updated
      • delete

        @Supported(scriptingApi=true)
        public Map<String,​Object> delete​(String resourceName,
                                               String rev)
                                        throws ResourceException
        Deletes an object.
        Parameters:
        resourceName - The complete path to the object to be deleted, including its ID.
        rev - The revision of the object to be deleted. Use null if the object is not subject to revision control, or if you want to skip the revision check and delete the object, regardless of the revision.
        Returns:
        The deleted object
        Throws:
        ResourceException - when the object cannot be deleted
      • delete

        @Supported(scriptingApi=true)
        public Map<String,​Object> delete​(String resourceName,
                                               String rev,
                                               Map<String,​Object> params)
                                        throws ResourceException
        Deletes an object.
        Parameters:
        resourceName - The complete path to the object to be deleted, including its ID.
        rev - The revision of the object to be deleted. Use null if the object is not subject to revision control, or if you want to skip the revision check and delete the object, regardless of the revision.
        params - The parameters that are passed to the delete request.
        Returns:
        The deleted object
        Throws:
        ResourceException - when the object cannot be deleted
      • delete

        @Supported(scriptingApi=true)
        public Map<String,​Object> delete​(String resourceName,
                                               String rev,
                                               Map<String,​Object> params,
                                               List<Object> fields)
                                        throws ResourceException
        Deletes an object.
        Parameters:
        resourceName - The complete path to the object to be deleted, including its ID.
        rev - The revision of the object to be deleted. Use null if the object is not subject to revision control, or if you want to skip the revision check and delete the object, regardless of the revision.
        params - The parameters that are passed to the delete request.
        fields - An array of the fields that should be returned in the result. The list of fields can include wild cards, such as * or *_ref. If no fields are specified, the entire object is returned.
        Returns:
        The deleted object
        Throws:
        ResourceException - when the object cannot be deleted
      • patch

        @Supported(scriptingApi=true)
        public Map<String,​Object> patch​(String resourceName,
                                              String rev,
                                              List<Object> patch)
                                       throws ResourceException
        Performs a partial modification of a managed or system object. Unlike the update function, only the modified attributes are provided, not the entire object.
        Parameters:
        resourceName - The full path to the object being updated, including the ID.
        rev - The revision of the object to be updated. Use null if the object is not subject to revision control, or if you want to skip the revision check and update the object, regardless of the revision.
        patch - An array of one or more JSON objects.

        The value of the modifications to be applied to the object. The patch set includes the operation type, the field to be changed, and the new values. A PATCH request can add, remove, replace, or increment an attribute value.

        Returns:
        The modified resource object.
        Throws:
        ResourceException - when the object could not be patched
      • patch

        @Supported(scriptingApi=true)
        public Map<String,​Object> patch​(String resourceName,
                                              String rev,
                                              List<Object> patch,
                                              Map<String,​Object> params)
                                       throws ResourceException
        Performs a partial modification of a managed or system object. Unlike the update function, only the modified attributes are provided, not the entire object.
        Parameters:
        resourceName - The full path to the object being updated, including the ID.
        rev - The revision of the object to be updated. Use null if the object is not subject to revision control, or if you want to skip the revision check and update the object, regardless of the revision.
        patch - An array of one or more JSON objects.

        The value of the modifications to be applied to the object. The patch set includes the operation type, the field to be changed, and the new values. A PATCH request can add, remove, replace, or increment an attribute value.

        params - Additional parameters that are passed to the patch request.
        Returns:
        The modified resource object.
        Throws:
        ResourceException - when the object could not be patched
      • patch

        @Supported(scriptingApi=true)
        public Map<String,​Object> patch​(String resourceName,
                                              String rev,
                                              List<Object> patch,
                                              Map<String,​Object> params,
                                              List<Object> fields)
                                       throws ResourceException
        Performs a partial modification of a managed or system object. Unlike the update function, only the modified attributes are provided, not the entire object.
        Parameters:
        resourceName - The full path to the object being updated, including the ID.
        rev - The revision of the object to be updated. Use null if the object is not subject to revision control, or if you want to skip the revision check and update the object, regardless of the revision.
        patch - An array of one or more JSON objects.

        The value of the modifications to be applied to the object. The patch set includes the operation type, the field to be changed, and the new values. A PATCH request can add, remove, replace, or increment an attribute value.

        params - Additional parameters that are passed to the patch request.
        fields - An array of the fields that should be returned in the result. The list of fields can include wild cards, such as * or *_ref. If no fields are specified, the entire new object is returned.
        Returns:
        The modified resource object.
        Throws:
        ResourceException - when the object could not be patched
      • action

        @Supported(scriptingApi=true)
        public Map<String,​Object> action​(String resource,
                                               String actionName)
                                        throws ResourceException
        Performs an action on an object.
        Parameters:
        resource - The resource that the function acts upon, for example, managed/user.
        actionName - The action to execute. Actions are used to represent functionality that is not covered by the standard methods for a resource (create, read, update, delete, patch, or query). In general, you should not use the openidm.action function for create, read, update, patch, delete or query operations. Instead, use the corresponding function specific to the operation (for example, openidm.create).
        Returns:
        Result of the action, may be null.
        Throws:
        ResourceException - when the action fails
      • action

        @Supported(scriptingApi=true)
        public Map<String,​Object> action​(String resource,
                                               String actionName,
                                               Map<String,​Object> content)
                                        throws ResourceException
        Performs an action on an object.
        Parameters:
        resource - The resource that the function acts upon, for example, managed/user.
        actionName - The action to execute. Actions are used to represent functionality that is not covered by the standard methods for a resource (create, read, update, delete, patch, or query). In general, you should not use the openidm.action function for create, read, update, patch, delete or query operations. Instead, use the corresponding function specific to the operation (for example, openidm.create).
        content - Content given to the action for processing.
        Returns:
        Result of the action, may be null.
        Throws:
        ResourceException - when the action fails
      • action

        @Supported(scriptingApi=true)
        public Map<String,​Object> action​(String resource,
                                               String actionName,
                                               Map<String,​Object> content,
                                               Map<String,​Object> params)
                                        throws ResourceException
        Performs an action on an object.
        Parameters:
        resource - The resource that the function acts upon, for example, managed/user.
        actionName - The action to execute. Actions are used to represent functionality that is not covered by the standard methods for a resource (create, read, update, delete, patch, or query). In general, you should not use the openidm.action function for create, read, update, patch, delete or query operations. Instead, use the corresponding function specific to the operation (for example, openidm.create).
        content - Content given to the action for processing.
        params - Additional parameters passed to the script. The params object must be a set of simple key:value pairs, and cannot include complex values.
        Returns:
        Result of the action, may be null.
        Throws:
        ResourceException - when the action fails
      • action

        @Supported(scriptingApi=true)
        public Map<String,​Object> action​(String resource,
                                               String actionName,
                                               Map<String,​Object> content,
                                               Map<String,​Object> params,
                                               List<Object> fields)
                                        throws ResourceException
        Performs an action on an object.
        Parameters:
        resource - The resource that the function acts upon, for example, managed/user.
        actionName - The action to execute. Actions are used to represent functionality that is not covered by the standard methods for a resource (create, read, update, delete, patch, or query). In general, you should not use the openidm.action function for create, read, update, patch, delete or query operations. Instead, use the corresponding function specific to the operation (for example, openidm.create).
        content - Content given to the action for processing.
        params - Additional parameters passed to the script. The params object must be a set of simple key:value pairs, and cannot include complex values.
        fields - An array of the fields that should be returned in the result. The list of fields can include wild cards, such as * or *_ref. If no fields are specified, the entire object is returned.
        Returns:
        Result of the action, may be null.
        Throws:
        ResourceException - when the action fails
      • query

        @Supported(scriptingApi=true)
        public Map<String,​Object> query​(String resourceName,
                                              Map<String,​Object> params)
                                       throws ResourceException
        Performs a query on the specified resource object.
        Parameters:
        resourceName - The resource name of the object to be queried
        params - The parameters that are passed to the query (_queryFilter, or _queryId). Additional parameters passed to the query will differ, depending on the query.
        Returns:
        The result of the query.
        Throws:
        ResourceException - when the object could not be queried
      • query

        @Supported(scriptingApi=true)
        public Map<String,​Object> query​(String resourceName,
                                              Map<String,​Object> params,
                                              List<Object> fields)
                                       throws ResourceException
        Performs a query on the specified resource object.
        Parameters:
        resourceName - The resource name of the object to be queried
        params - The parameters that are passed to the query (_queryFilter, or _queryId). Additional parameters passed to the query will differ, depending on the query.
        fields - A list of the fields that should be returned in the result. The list of fields can include wild cards, such as * or *_ref.
        Returns:
        The result of the query.
        Throws:
        ResourceException - when the object could not be queried