Package com.simplicite.bpm
Class Processus
- java.lang.Object
-
- com.simplicite.bpm.ProcessusCore
-
- com.simplicite.bpm.Processus
-
- All Implemented Interfaces:
CacheInterface
,java.io.Serializable
- Direct Known Subclasses:
ScriptedProcessus
public class Processus extends ProcessusCore
Business process
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PARAM_FILTER_PROCESS
Filter process param-
Fields inherited from class com.simplicite.bpm.ProcessusCore
CANCEL, NEW, READ, STATE_CANCELED, STATE_DONE, STATE_RUNNING, STATE_STARTED, TYPE_ACTIVITY, TYPE_GUI, TYPE_SCREENFLOW, UNIT_DAY, UNIT_HOUR, UNIT_MINUTE, UNIT_MONTH, UNIT_SECOND, UNIT_YEAR
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Message
abandon()
Abandon the process before the endMessage
activate()
Activate a process and return the first user activityDataFile
addDynamicData(ActivityFile context, java.lang.String name, java.lang.String def)
Add dynamically a Data to the activity (useful in external activity)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)void
backward(ActivityFile context, ActivityFile back)
Hook called on a backward event of a user activityMessage
cancel(Activity a, java.lang.String aid)
Cancel/Skip a user activity (status CANCEL)int[]
getCacheInfo()
Get cache info: current and max size of processesActivityFile
getContext(Activity a)
Load the activity contextActivityFile
getContext(Activity a, java.lang.String aid)
Load the activity contextActivityFile
getCurrentActivity()
Return the current activity of a screenflow.java.lang.String
getMainObject(ActivityFile context)
Return the main object of the business process.java.lang.String
getParameter(Activity a, java.lang.String group, java.lang.String name)
Read a contextual data in activityjava.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 activityjava.util.List<java.lang.String>
getParameter(java.lang.String road)
Read a contextual data in the processActivityFile
getPreviousContext(ActivityFile context)
Return the previous activityProcessRoad
history(ActivityFile last, boolean full)
Process history (for long process stored in DB)void
init(Grant g)
Hook after definition loadingvoid
instantiate()
New process instancevoid
invokeCallback(ActivityFile context, java.lang.String callbackName)
Simple callback method calljava.lang.String
invokePageMethod(ActivityFile context, java.lang.Object ctx, java.lang.String method)
java.lang.String
invokeServiceMethod(ActivityFile context, java.lang.String method, java.util.List<?> params)
boolean
isUndoable()
Hook to allow undo/redo the full processjava.lang.String
javascript(java.lang.String js)
Alias to sendJavaScriptAlert
loadAlert(int type, java.lang.String name, ObjectDB obj)
Load the alert definitionAlert
loadAlert(java.lang.String id, int type, ObjectDB obj)
Load the alert definitionMessage
lock(Activity a, java.lang.String aid)
Lock foreground (user dialog) activity (status RUNNING).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]java.lang.String[]
parseValues(ActivityFile context, DataFile df)
Parse all valuesvoid
postAbandon()
Hook called after a process abandon (useful for specific cleaning)void
postActivate()
Hook called after activationvoid
postCancel(ActivityFile context)
Hook called after activity canceling/skippingvoid
postInstantiate(Grant g)
Hook called when one process is instantiatedvoid
postLock(ActivityFile context)
Hook called after the lock of a foreground activity (user dialog)void
postTerminate()
Hook called after termination of processvoid
postUnlock(ActivityFile context)
Hook called after the unlock of a foreground activity (user dialog)void
postValidate(ActivityFile context)
Hook called when the activity has been validated (useful to add specific controls)Message
preAbandon()
Hook called before a process abandonMessage
preActivate()
Hook called before activationMessage
preCancel(ActivityFile context)
Hook called before activity canceling/skippingMessage
preLock(ActivityFile context)
Hook called before the lock of a foreground activity (user dialog)Message
preTerminate()
Hook called before termination of processMessage
preUnlock(ActivityFile context)
Hook called before the unlock of a foreground activity (user dialog)Message
preValidate(ActivityFile context)
Hook called before activity validation (useful to change/complete data)java.lang.String
redirect(java.lang.String url)
Alias to sendRedirectjava.lang.String
sendJavaScript(java.lang.String js)
Generate a JavaScript statementjava.lang.String
sendRedirect(java.lang.String url)
Generate a redirect statementvoid
storeContext(ActivityFile context)
Store the activity context (in session for a screenflow, or in DB for a persistent workflow)Message
terminate()
Terminate the process (automatically called at the END of process)java.lang.String
unitTests()
Unit testsMessage
unlock(Activity a, java.lang.String aid)
Unlock foreground (user dialog) activity (status WAITING).Message
validate(ActivityFile context)
Hook called when the activity must be manually validatedMessage
validate(ActivityFile context, ObjectDB obj)
Common activity validation-
Methods inherited from class com.simplicite.bpm.ProcessusCore
addActivity, addPermission, addSharedScript, addTransition, delPermission, enableGC, garbageCollection, getActivities, getActivity, getAlert, getBegin, getCacheKey, getClassName, getCompensationProcess, getConsole, getData, getDeadline, getDisplay, getEnd, getGrant, getId, getLabel, getMainActivity, getMainObjectCascadeDelete, getModuleId, getModuleName, getName, getNext, getNext, getNextActions, getNextActions, getParentContext, getPermissions, getPersistenceDepth, getPID, getPrevious, getProcessId, getProcessName, getProcessParameter, getProcessRoad, getScriptId, getSharedScripts, getShortName, getTransition, getTransitions, getType, initProcessRoad, isCancelGranted, isCancelGranted, isJavaImplemented, isMultiUsers, isNewGranted, isNewGranted, isReadGranted, isReadGranted, isScreenFlow, lastUsage, persistWhenTerminated, readScript, removeProcessParameter, setAlert, setClassName, setCompensationProcess, setConsole, setData, setDisplay, setDuration, setGrant, setId, setLabel, setMainActivityStep, setMainObjectCascadeDelete, setModuleId, setModuleName, setName, setParentContext, setPersistenceWhenTerminated, setPID, setProcessParameter, setScriptId, setShortName, setType, toJSONObject, toString
-
-
-
-
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
-
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 warningname
- Alert nameobj
- 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 idtype
- info or warningobj
- 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
- Activityaid
- 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
- Activityaid
- 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 contextback
- The backward activity context
-
validate
public Message validate(ActivityFile context, ObjectDB obj)
Common activity validation- Parameters:
context
- Activity contextobj
- 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
- Activityaid
- 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
- Activityaid
- 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
- Activityindex
- First, Last, All, or nullgroup
- Group of dataname
- 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
- Activitygroup
- Group of dataname
- 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 contextvalue
- The text to parse- Returns:
- Parsed value
-
parseValues
public java.lang.String[] parseValues(ActivityFile context, DataFile df)
Parse all values- Parameters:
context
- Activity contextdf
- 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 contextname
- Data name in group Datadef
- 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 contextgroup
- Data group namename
- Data namedef
- Static valuevalue
- Value- Returns:
- DataFile
-
invokeCallback
public void invokeCallback(ActivityFile context, java.lang.String callbackName) throws MethodException
Simple callback method call
- Parameters:
context
- ContextcallbackName
- Callback name- Throws:
MethodException
- method exception
-
invokePageMethod
public java.lang.String invokePageMethod(ActivityFile context, java.lang.Object ctx, java.lang.String method) throws MethodException
- Throws:
MethodException
-
invokeServiceMethod
public java.lang.String invokeServiceMethod(ActivityFile context, java.lang.String method, java.util.List<?> params) throws MethodException
- 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 nullfull
- 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
-
-