Interface TransformScript<T extends ProvisionObject>

  • Type Parameters:
    T - The type of provision object being transformed (e.g., ProvisionUser, ProvisionGroup)
    All Superinterfaces:
    org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.Aware
    All Known Implementing Classes:
    AbstractGroupTransformScript, AbstractLogTransformScript, AbstractManSysTransformationScript, AbstractOrganizationTransformScript, AbstractResourceTransformationScript, AbstractRoleTransformScript, AbstractTransformScript, AbstractUserTransformScript

    public interface TransformScript<T extends ProvisionObject>
    extends org.springframework.context.ApplicationContextAware
    Core interface that defines the contract for all identity transformation scripts in the OpenIAM synchronization framework.

    Transformation scripts are responsible for mapping source data from external systems (represented as a LineObject) to OpenIAM identity objects (extending ProvisionObject). These scripts provide the flexibility to implement custom business logic during the synchronization process, allowing organizations to tailor their identity workflows to specific requirements.

    Implementations of this interface can be written in Java or provided as Groovy scripts that are loaded dynamically at runtime. The framework provides abstract base classes that simplify the implementation of transformation scripts:

    • AbstractTransformScript - Base implementation with core utility methods
    • AbstractUserTransformScript - Specialized implementation for user transformations
    • AbstractGroupTransformScript - Specialized implementation for group transformations
    • AbstractRoleTransformScript - Specialized implementation for role transformations

    The transformation process follows these steps:

    1. The init() method is called to initialize the script
    2. For each row of data from the source system, the execute(LineObject, ProvisionObject) method is invoked to transform the data
    3. The script returns a status code indicating how the synchronization process should proceed

    This interface extends ApplicationContextAware to allow implementations to access Spring beans and services from the application context.

    Since:
    2.0
    See Also:
    LineObject, ProvisionObject, ApplicationContextAware
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DELETE
      Status code indicating that the object should be deleted.
      static int DISABLE
      Status code indicating that the object should be disabled rather than deleted.
      static int ENABLE
      Status code indicating that the object should be enabled.
      static int EXCEPTION
      Status code indicating that an exception occurred during transformation.
      static int INITIATE_ADD_USER_AND_INVITE_WORKFLOW
      Status code indicating that an add user and invite workflow should be initiated.
      static int INITIATE_CHANGE_POSITION_WORKFLOW
      Status code indicating that a change position workflow should be initiated.
      static int INITIATE_EDIT_USER_WORKFLOW
      Status code indicating that an edit user workflow should be initiated.
      static int INITIATE_NEW_HIRE_WORKFLOW
      Status code indicating that a new hire workflow should be initiated.
      static int INITIATE_REVOKE_ACCESS_WORKFLOW
      Status code indicating that a revoke access workflow should be initiated.
      static int INITIATE_TERMINATE_USER_WORKFLOW
      Status code indicating that a terminate user workflow should be initiated.
      static int NO_DELETE
      Status code indicating that the object should not be deleted.
      static int SKIP
      Status code indicating that the current record should be skipped and considered an error.
      static int SKIP_OK
      Status code indicating that the current record should be skipped but not treated as an error.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int execute​(LineObject rowObj, T pUser)
      Executes the transformation logic for a single record from the source system.
      void init()
      Initializes the transformation script.
      boolean isNewUser()
      Determines if the current synchronization operation is for a new user creation.
      void setNewUser​(boolean isNewUser)
      Sets the flag indicating whether the current synchronization operation is for a new user creation.
      • Methods inherited from interface org.springframework.context.ApplicationContextAware

        setApplicationContext
    • Field Detail

      • SKIP

        static final int SKIP
        Status code indicating that the current record should be skipped and considered an error. This will increment error counters in the synchronization process.
        See Also:
        Constant Field Values
      • NO_DELETE

        static final int NO_DELETE
        Status code indicating that the object should not be deleted. Used when processing delete operations in the synchronization.
        See Also:
        Constant Field Values
      • DELETE

        static final int DELETE
        Status code indicating that the object should be deleted. The synchronization process will initiate a delete operation for the object.
        See Also:
        Constant Field Values
      • DISABLE

        static final int DISABLE
        Status code indicating that the object should be disabled rather than deleted. The synchronization process will initiate a disable operation for the object.
        See Also:
        Constant Field Values
      • ENABLE

        static final int ENABLE
        Status code indicating that the object should be enabled. The synchronization process will initiate an enable operation for the object.
        See Also:
        Constant Field Values
      • EXCEPTION

        static final int EXCEPTION
        Status code indicating that an exception occurred during transformation. The synchronization process will handle this as an error condition.
        See Also:
        Constant Field Values
      • INITIATE_NEW_HIRE_WORKFLOW

        static final int INITIATE_NEW_HIRE_WORKFLOW
        Status code indicating that a new hire workflow should be initiated. The synchronization process will trigger the configured new hire workflow.
        See Also:
        Constant Field Values
      • INITIATE_EDIT_USER_WORKFLOW

        static final int INITIATE_EDIT_USER_WORKFLOW
        Status code indicating that an edit user workflow should be initiated. The synchronization process will trigger the configured edit user workflow.
        See Also:
        Constant Field Values
      • INITIATE_REVOKE_ACCESS_WORKFLOW

        static final int INITIATE_REVOKE_ACCESS_WORKFLOW
        Status code indicating that a revoke access workflow should be initiated. The synchronization process will trigger the configured revoke access workflow.
        See Also:
        Constant Field Values
      • INITIATE_CHANGE_POSITION_WORKFLOW

        static final int INITIATE_CHANGE_POSITION_WORKFLOW
        Status code indicating that a change position workflow should be initiated. The synchronization process will trigger the configured change position workflow.
        See Also:
        Constant Field Values
      • INITIATE_ADD_USER_AND_INVITE_WORKFLOW

        static final int INITIATE_ADD_USER_AND_INVITE_WORKFLOW
        Status code indicating that an add user and invite workflow should be initiated. The synchronization process will trigger the configured add user and invite workflow.
        See Also:
        Constant Field Values
      • INITIATE_TERMINATE_USER_WORKFLOW

        static final int INITIATE_TERMINATE_USER_WORKFLOW
        Status code indicating that a terminate user workflow should be initiated. The synchronization process will trigger the configured terminate user workflow.
        See Also:
        Constant Field Values
      • SKIP_OK

        static final int SKIP_OK
        Status code indicating that the current record should be skipped but not treated as an error. This will not increment error counters in the synchronization process.
        See Also:
        Constant Field Values
    • Method Detail

      • execute

        int execute​(LineObject rowObj,
                    T pUser)
        Executes the transformation logic for a single record from the source system.

        This method is the core of the transformation script, where custom business logic is implemented to map data from the source system (represented by rowObj) to the target OpenIAM identity object (represented by pUser). The implementation should:

        1. Extract relevant data from the rowObj
        2. Transform the data according to business rules
        3. Update the pUser object with the transformed data
        4. Return an appropriate status code to control the synchronization flow

        The return value determines how the synchronization process handles the record:

        • Return SKIP or SKIP_OK to skip the record
        • Return DELETE, DISABLE, or ENABLE to control object lifecycle
        • Return one of the INITIATE_* constants to trigger a workflow
        • Return EXCEPTION to indicate an error condition
        Parameters:
        rowObj - The source data record to be transformed
        pUser - The target identity object to be populated
        Returns:
        A status code indicating how to proceed with the synchronization
      • init

        void init()
        Initializes the transformation script.

        This method is called once before processing begins, allowing the script to perform any necessary setup operations such as:

        • Initializing internal data structures
        • Loading reference data
        • Establishing connections to required services
        • Setting up caches for frequently accessed data

        Implementations should use this method to prepare the script for efficient execution of multiple execute(LineObject, ProvisionObject) calls.

      • isNewUser

        boolean isNewUser()
        Determines if the current synchronization operation is for a new user creation.

        This method is used to distinguish between new user creation and existing user updates, which may require different logic in the transformation script.

        Returns:
        true if the operation is creating a new user, false if updating an existing user
      • setNewUser

        void setNewUser​(boolean isNewUser)
        Sets the flag indicating whether the current synchronization operation is for a new user creation.

        This method is typically called by the synchronization framework to inform the transformation script about the nature of the current operation.

        Parameters:
        isNewUser - true if the operation is creating a new user, false if updating an existing user