Class Processus

    • Field Detail

      • PARAM_FILTER_PROCESS

        public static final java.lang.String PARAM_FILTER_PROCESS
        Filter process param
        See Also:
        Constant Field Values
    • Constructor Detail

      • Processus

        public Processus()
        Default constructor
      • Processus

        public Processus​(Grant g)
        Constructor
        Parameters:
        g - Grant
    • Method Detail

      • getUUID

        public java.lang.String getUUID()
        Return instance UUID
        Returns:
        Instance UUID
      • getCacheInfo

        public int[] getCacheInfo()
        Get cache info: current and max size of processes
        Returns:
        Cache Info
      • init

        public void init​(Grant g)
        Hook after definition loading
        Parameters:
        g - Grant
      • instantiate

        public void instantiate()
        New process instance
      • postInstantiate

        public void postInstantiate​(Grant g)
        Hook called when one process is instantiated
        Parameters:
        g - User rights
      • loadAlert

        public Alert loadAlert​(int type,
                               java.lang.String name,
                               ObjectDB obj)
        Load the alert definition
        Parameters:
        type - info or warning
        name - Alert name
        obj - Business object (with a state model)
        Returns:
        Alert definition
      • loadAlert

        public Alert loadAlert​(java.lang.String id,
                               int type,
                               ObjectDB obj)
        Load the alert definition
        Parameters:
        id - alert id
        type - info or warning
        obj - Business object (with a state model)
        Returns:
        Alert definition
      • isUndoable

        public boolean isUndoable()
        Hook to allow undo/redo the full process
        Returns:
        true by default if the process is a screenflow
      • activate

        public Message activate()
        Activate a process and return the first user activity
        Returns:
        message with error or Activity
      • preActivate

        public Message preActivate()
        Hook called before activation
        Returns:
        null or error
      • postActivate

        public void postActivate()
        Hook called after activation
      • terminate

        public Message terminate()
        Terminate the process (automatically called at the END of process)
        Returns:
        message
      • preTerminate

        public Message preTerminate()
        Hook called before termination of process
        Returns:
        null or error
      • postTerminate

        public void postTerminate()
        Hook called after termination of process
      • abandon

        public Message abandon()
        Abandon the process before the end
        Returns:
        message
      • preAbandon

        public Message preAbandon()
        Hook called before a process abandon
        Returns:
        null or error to abort the abandon
      • postAbandon

        public void postAbandon()
        Hook called after a process abandon (useful for specific cleaning)
      • lock

        public Message lock​(Activity a,
                            java.lang.String aid)
        Lock foreground (user dialog) activity (status RUNNING). Background activities are not locked.
        Parameters:
        a - Activity
        aid - Activity file row id
        Returns:
        message
      • preLock

        public Message preLock​(ActivityFile context)
        Hook called before the lock of a foreground activity (user dialog)
        Parameters:
        context - The activity context
        Returns:
        null or error
      • postLock

        public void postLock​(ActivityFile context)
        Hook called after the lock of a foreground activity (user dialog)
        Parameters:
        context - The activity context
      • unlock

        public Message unlock​(Activity a,
                              java.lang.String aid)
        Unlock foreground (user dialog) activity (status WAITING). Background activities are not unlocked.
        Parameters:
        a - Activity
        aid - Activity file row id
        Returns:
        message
      • preUnlock

        public Message preUnlock​(ActivityFile context)
        Hook called before the unlock of a foreground activity (user dialog)
        Parameters:
        context - The activity context
        Returns:
        null or error
      • postUnlock

        public void postUnlock​(ActivityFile context)
        Hook called after the unlock of a foreground activity (user dialog)
        Parameters:
        context - The activity context
      • backward

        public void backward​(ActivityFile context,
                             ActivityFile back)
        Hook called on a backward event of a user activity
        Parameters:
        context - The current activity context
        back - The backward activity context
      • validate

        public Message validate​(ActivityFile context,
                                ObjectDB obj)
        Common activity validation
        Parameters:
        context - Activity context
        obj - Optional object (Search and CRUD activities based on a business object)
        Returns:
        Message with the next Activity or errors
      • validate

        public Message validate​(ActivityFile context)
                         throws java.lang.Exception
        Hook called when the activity must be manually validated
        Parameters:
        context - The activity context
        Returns:
        Message with the validated/completed 'Activity', or errors
        Throws:
        java.lang.Exception - exception
      • preValidate

        public Message preValidate​(ActivityFile context)
        Hook called before activity validation (useful to change/complete data)
        Parameters:
        context - The activity context
        Returns:
        null or errors
      • postValidate

        public void postValidate​(ActivityFile context)
        Hook called when the activity has been validated (useful to add specific controls)
        Parameters:
        context - The activity context
      • cancel

        public Message cancel​(Activity a,
                              java.lang.String aid)
        Cancel/Skip a user activity (status CANCEL)
        Parameters:
        a - Activity
        aid - Activity file row id
        Returns:
        message
      • preCancel

        public Message preCancel​(ActivityFile context)
        Hook called before activity canceling/skipping
        Parameters:
        context - The activity context
        Returns:
        null or error
      • postCancel

        public void postCancel​(ActivityFile context)
        Hook called after activity canceling/skipping
        Parameters:
        context - The activity context
      • getPreviousContext

        public ActivityFile getPreviousContext​(ActivityFile context)
        Return the previous activity
        Parameters:
        context - Current activity context
        Returns:
        previous one
      • getContext

        public ActivityFile getContext​(Activity a,
                                       java.lang.String aid)
        Load the activity context
        Parameters:
        a - Activity
        aid - Activity file row id (or null in a screenflow)
        Returns:
        Activity context
      • getContext

        public final ActivityFile getContext​(Activity a)
        Load the activity context
        Parameters:
        a - Activity
        Returns:
        Activity context (first one in case of human process)
      • storeContext

        public void storeContext​(ActivityFile context)
        Store the activity context (in session for a screenflow, or in DB for a persistent workflow)
        Parameters:
        context - Activity context
      • getParameter

        public java.util.List<java.lang.String> getParameter​(java.lang.String road)
        Read a contextual data in the process
        Parameters:
        road - Road of data under brackets [stepname(.stepindex).groupname.dataname]. ex: [MyStep.Field.row_id], [MyStep.Field.MyRefId.MyField], [MyStep.Last.Filter.MyField]
        Returns:
        Values
      • getParameter

        public java.util.List<java.lang.String> getParameter​(Activity a,
                                                             java.lang.String index,
                                                             java.lang.String group,
                                                             java.lang.String name)
        Read a contextual data in activity
        Parameters:
        a - Activity
        index - First, Last, All, or null
        group - Group of data
        name - Parameter name
        Returns:
        Values
      • getParameter

        public java.lang.String getParameter​(Activity a,
                                             java.lang.String group,
                                             java.lang.String name)
        Read a contextual data in activity
        Parameters:
        a - Activity
        group - Group of data
        name - Parameter name
        Returns:
        Value
      • parseValue

        public java.lang.String parseValue​(ActivityFile context,
                                           java.lang.String value)
        Parse a value with replacement of tokens under brackets : [login], [lang], [now], [text:code], [step.index.group.data]
        Parameters:
        context - Activity context
        value - The text to parse
        Returns:
        Parsed value
      • parseValues

        public java.lang.String[] parseValues​(ActivityFile context,
                                              DataFile df)
        Parse all values
        Parameters:
        context - Activity context
        df - Data file
        Returns:
        Parsed values array
      • getCurrentActivity

        public ActivityFile getCurrentActivity()
        Return the current activity of a screenflow.
        Returns:
        ActivityFile
      • addDynamicData

        public DataFile addDynamicData​(ActivityFile context,
                                       java.lang.String name,
                                       java.lang.String def)
        Add dynamically a Data to the activity (useful in external activity)
        Parameters:
        context - Activity context
        name - Data name in group Data
        def - Static value
        Returns:
        DataFile
      • addDynamicData

        public DataFile addDynamicData​(ActivityFile context,
                                       java.lang.String group,
                                       java.lang.String name,
                                       java.lang.String def,
                                       java.lang.String value)
        Add dynamically a Data to the activity (useful in external activity)
        Parameters:
        context - Activity context
        group - Data group name
        name - Data name
        def - Static value
        value - Value
        Returns:
        DataFile
      • invokeCallback

        public void invokeCallback​(ActivityFile context,
                                   java.lang.String callbackName)
                            throws MethodException
        Simple callback method call
        Parameters:
        context - Context
        callbackName - Callback name
        Throws:
        MethodException - method exception
      • invokePageMethod

        public java.lang.String invokePageMethod​(ActivityFile context,
                                                 java.lang.Object ctx,
                                                 java.lang.String method)
                                          throws MethodException
        Page method call
        Parameters:
        context - COntext
        method - Method
        Returns:
        Call result
        Throws:
        MethodException
      • invokeServiceMethod

        public java.lang.String invokeServiceMethod​(ActivityFile context,
                                                    java.lang.String method,
                                                    java.util.List<?> params)
                                             throws MethodException
        Service method call
        Parameters:
        context - Context
        method - Method
        params - Parameters
        Returns:
        Call result
        Throws:
        MethodException
      • getMainObject

        public java.lang.String getMainObject​(ActivityFile context)
        Return the main object of the business process. To override if activity is not based on business object.
        Parameters:
        context - Activity context
        Returns:
        object:id
      • history

        public ProcessRoad history​(ActivityFile last,
                                   boolean full)
        Process history (for long process stored in DB)
        Parameters:
        last - History to this optional context, search all if null
        full - All activities or only UI dialog ?
        Returns:
        Process road with activities
      • sendRedirect

        public java.lang.String sendRedirect​(java.lang.String url)
        Generate a redirect statement
        Parameters:
        url - URL to redirect to
      • redirect

        public java.lang.String redirect​(java.lang.String url)
        Alias to sendRedirect
      • sendJavaScript

        public java.lang.String sendJavaScript​(java.lang.String js)
        Generate a JavaScript statement
        Parameters:
        js - JavaScript statement
      • javascript

        public java.lang.String javascript​(java.lang.String js)
        Alias to sendJavaScript
      • unitTests

        public java.lang.String unitTests()
        Unit tests
        Returns:
        Unit tests results