Class ProcessusCore

    • Constructor Detail

      • ProcessusCore

        public ProcessusCore()
    • Method Detail

      • getProcessId

        public static java.lang.String getProcessId​(java.lang.String name)
        Get process row Id from name
        Parameters:
        name - Name
        Returns:
        Process row Id
      • getProcessName

        public static java.lang.String getProcessName​(java.lang.String rowId)
        Get process name from rowId
        Parameters:
        rowId - Row Id
        Returns:
        Process name
      • getCacheKey

        public java.lang.String getCacheKey​(Grant g)
        Get process unique cache key
        Specified by:
        getCacheKey in interface CacheInterface
        Parameters:
        g - Grant
        Returns:
        Cache key of object instance
      • lastUsage

        public long lastUsage​(boolean update)
        Last usage timestamp (last access to process engine)
        Specified by:
        lastUsage in interface CacheInterface
        Parameters:
        update - true to update the current time
        Returns:
        Last usage in millisecond (-1 no GC)
      • enableGC

        public void enableGC​(boolean enabled)
        Enable or disable the internal GC
        Specified by:
        enableGC in interface CacheInterface
        Parameters:
        enabled - false to disable internal GC
      • garbageCollection

        public boolean garbageCollection()
        Garbage collection of dynamic data
        Specified by:
        garbageCollection in interface CacheInterface
        Returns:
        true if something has been cleared
      • getData

        public ProcessusData getData()
        Get process instance data
        Returns:
        Process instance data
      • setData

        public void setData​(ProcessusData data)
        Set process instance data
        Parameters:
        data - Process instance data
      • getGrant

        public Grant getGrant()
        Get the rights of the process user
        Returns:
        rights of the process user
      • setGrant

        public void setGrant​(Grant g)
        Set the rights of the process user
        Parameters:
        g - User rights
      • getPID

        public java.lang.String getPID()
        Get the process instance ID (bpm_process_file row ID)
        Returns:
        process instance ID
      • setPID

        public void setPID​(java.lang.String pid)
        Set the process instance ID (bpm_process_file row ID)
        Parameters:
        pid - process instance ID
      • getId

        public java.lang.String getId()
        Get process definition ID
        Returns:
        Process definition ID
      • setId

        public void setId​(java.lang.String id)
        Set process definition ID
        Parameters:
        id - Process definition ID
      • getName

        public java.lang.String getName()
        Get process name
        Specified by:
        getName in interface CacheInterface
        Returns:
        Process name
      • setName

        public void setName​(java.lang.String name)
        Set process name
        Parameters:
        name - Process name
      • getShortName

        public java.lang.String getShortName()
        Get process short name
        Returns:
        Process short name
      • setShortName

        public void setShortName​(java.lang.String name)
        Set process short name
        Parameters:
        name - Process short name
      • getModuleId

        public java.lang.String getModuleId()
        Get process module ID
        Returns:
        Process module ID
      • setModuleId

        public void setModuleId​(java.lang.String mdlId)
        Set process module ID
        Parameters:
        mdlId - Process module ID
      • getModuleName

        public java.lang.String getModuleName()
        Get process module name
        Returns:
        Process module name
      • setModuleName

        public void setModuleName​(java.lang.String mdl)
        Set process module name
        Parameters:
        mdl - Process module name
      • getClassName

        public java.lang.String getClassName()
        Get process class name
        Returns:
        Process class name
      • setClassName

        public void setClassName​(java.lang.String cls)
        Set process class name
        Parameters:
        cls - Process class name
      • getType

        public int getType()
        Get process type
        Returns:
        Process type
      • setType

        public void setType​(int type)
        Set process type
        Parameters:
        type - Process type
      • isMultiUsers

        public boolean isMultiUsers()
        Is multiuser process type?
      • isScreenFlow

        public boolean isScreenFlow()
        Is screenflow process type?
      • persistWhenTerminated

        public boolean persistWhenTerminated()
        Persist process in DB when terminated ?
        Returns:
        Persist process in DB when terminated ?
      • getPersistenceDepth

        public int getPersistenceDepth()
      • setPersistenceWhenTerminated

        public void setPersistenceWhenTerminated​(boolean b,
                                                 int depth)
      • getScriptId

        public java.lang.String getScriptId()
        Get server script document ID
        Returns:
        document ID
      • setScriptId

        public void setScriptId​(java.lang.String id)
        Set server script document ID
        Parameters:
        id - document Id
      • readScript

        public java.lang.String readScript​(boolean force)
        Read server script document content (read using getScriptId())
        Parameters:
        force - Force ?
        Returns:
        script document content
      • getSharedScripts

        public java.util.List<SharedScript> getSharedScripts()
        Get all shared scripts
        Returns:
        all shared scripts
      • addSharedScript

        public void addSharedScript​(SharedScript s)
        Add a shared script
        Parameters:
        s - Script
      • getConsole

        public Console getConsole()
        Get console
      • setConsole

        public void setConsole​(Console console)
        Set console
      • getParentContext

        public ActivityFile getParentContext()
        Parent context in case of a sub-process
        Returns:
        Parent context
      • setParentContext

        public void setParentContext​(ActivityFile context)
      • getProcessParameter

        public java.lang.Object getProcessParameter​(java.lang.String name)
        Get a process parameter
        Parameters:
        name - Parameter name
        Returns:
        Object or null if unknown
      • setProcessParameter

        public void setProcessParameter​(java.lang.String name,
                                        java.lang.Object value)
        Set a process parameter
        Parameters:
        name - Parameter name
        value - Parameter
      • removeProcessParameter

        public void removeProcessParameter​(java.lang.String name)
        Remove a process parameter
        Parameters:
        name - Parameter name
      • getPermissions

        public java.util.Map<java.lang.String,​java.lang.String> getPermissions()
        Get all permissions by group:function where function = R, N or C
        Returns:
        all permissions by group:function
      • addPermission

        public void addPermission​(java.lang.String group,
                                  char grant)
        Add permission
        Parameters:
        group - Group name
        grant - READ/NEW/CANCEL
      • delPermission

        public void delPermission​(java.lang.String group,
                                  char grant)
        Delete permission
        Parameters:
        group - Group name
        grant - READ/NEW/CANCEL
      • isNewGranted

        public boolean isNewGranted​(java.lang.String group)
      • isNewGranted

        public boolean isNewGranted​(Grant g)
      • isReadGranted

        public boolean isReadGranted​(java.lang.String group)
      • isReadGranted

        public boolean isReadGranted​(Grant g)
      • isCancelGranted

        public boolean isCancelGranted​(java.lang.String group)
      • isCancelGranted

        public boolean isCancelGranted​(Grant g)
      • setDuration

        public void setDuration​(int max,
                                char unit)
        Set the max duration of the process (then send the deadline alert)
        Parameters:
        max - Quantity
        unit - Duration unit
      • getDeadline

        public java.lang.String getDeadline​(java.util.Date dt)
        Get the process deadline
        Parameters:
        dt - Start date
        Returns:
        Date yyyy-MM-dd HH:mm:ss (start date + duration)
      • getAlert

        public Alert getAlert()
        Deadline alert, may be null
        Returns:
        Deadline alert
      • setAlert

        public void setAlert​(Alert a)
      • getCompensationProcess

        public java.lang.String getCompensationProcess()
        Compensation process
        Returns:
        Compensation process
      • setCompensationProcess

        public void setCompensationProcess​(java.lang.String name)
      • getDisplay

        public java.lang.String getDisplay()
        Get process translation
        Returns:
        Process translation
      • getLabel

        public java.lang.String getLabel()
        Get process translation (alias to getDisplay)
        Returns:
        Process translation
      • setDisplay

        public void setDisplay​(java.lang.String d)
      • setLabel

        public void setLabel​(java.lang.String d)
      • addActivity

        public void addActivity​(Activity a)
        Add one activity to the process
        Parameters:
        a - Activity
      • getActivity

        public Activity getActivity​(java.lang.String step)
        Get the activity of a given step
        Parameters:
        step - The activity step
        Returns:
        Activity definition
      • setMainActivityStep

        public void setMainActivityStep​(java.lang.String step)
        Set the main activity of the process
        Parameters:
        step - Activity step
      • getMainActivity

        public Activity getMainActivity()
        Get he main activity if exists
        Returns:
        Activity definition
      • setMainObjectCascadeDelete

        public void setMainObjectCascadeDelete​(char del)
        Set cascade deletion of business process when main object is deleted
        Parameters:
        del - ObjectDB.DEL*
      • getMainObjectCascadeDelete

        public char getMainObjectCascadeDelete()
        Get cascade deletion of business process when main object is deleted
        Returns:
        cascade deletion of business process when main object is deleted
      • getActivities

        public java.util.List<Activity> getActivities()
        Get all activities
        Returns:
        ArrayList of activities
      • getTransitions

        public java.util.List<Transition> getTransitions()
        Get all transitions
        Returns:
        ArrayList of transitions
      • getTransition

        public Transition getTransition​(java.lang.String name)
        Get a transition
        Parameters:
        name - transition name (the transition must have a specified name)
        Returns:
        Transition
      • getBegin

        public Activity getBegin()
        Get the begin activity
        Returns:
        begin activity
      • getEnd

        public Activity getEnd()
        Get the end activity
        Returns:
        end activity
      • addTransition

        public void addTransition​(java.lang.String id,
                                  java.lang.String name,
                                  java.lang.String from,
                                  java.lang.String to,
                                  java.lang.String condition,
                                  java.lang.String callback,
                                  Alert alert,
                                  Action action)
        Add a transition between 2 activities
        Parameters:
        id - Transition id
        name - Transition name
        from - Origin step
        to - Destination step
        condition - Optional transition condition, null=no condition
        callback - Optional Callback method during transition
        alert - Optional Alert to send during transition
        action - Optional Action button
      • getNext

        public Transition getNext​(java.lang.String step,
                                  java.lang.String condition,
                                  java.lang.String action,
                                  java.lang.String nextStep)
        Get the available transition with a given condition. If no route exists with this condition, the next activity is the transition with the [DEFAULT] condition
        Parameters:
        step - Activity step
        condition - Optional Contextual value of condition
        action - Optional Action name
        nextStep - Optional Forced next step
        Returns:
        A transition or null if no route exists
      • getNext

        public java.util.List<Transition> getNext​(java.lang.String step)
        Get all transition from a given step without any condition
        Parameters:
        step - Activity step
        Returns:
        ArrayList of transitions
      • getNextActions

        public java.util.List<Transition> getNextActions​(java.lang.String step)
        Get all transitions with user Actions from a given step
        Parameters:
        step - Activity step
        Returns:
        ArrayList of transitions
      • getNextActions

        public java.util.List<Transition> getNextActions​(java.lang.String step,
                                                         boolean enabledOnly)
        Get all transitions with user Actions from a given step
        Parameters:
        step - Activity step
        enabledOnly - To ensure that action is enabled
        Returns:
        ArrayList of transitions
      • getPrevious

        public java.util.List<Activity> getPrevious​(java.lang.String step)
        Get all previous activities from a step
        Parameters:
        step - Activity step
        Returns:
        ArrayList of activities
      • initProcessRoad

        public void initProcessRoad()
      • toJSONObject

        public org.json.JSONObject toJSONObject()
        Generates a JSON object representation of the processus
        Returns:
        processus as JSON object
      • toString

        public java.lang.String toString()
        Generates a string representation of the processus
        Overrides:
        toString in class java.lang.Object
        Returns:
        processus as string