Package com.groiss.wf
Class SystemAction
java.lang.Object
com.groiss.wf.SystemAction
This class provides some methods useful for preprocessing and postconditions.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDocument
(String origin, String filepath, String docpath) Add a document to the process folder.void
add a folder to the process.void
addSubform
(String form, String id) Add a subform.void
autoTake()
This method performs a take when the activity instance is assigned to a role and there is exactly one user having this role.void
cancelActivity
(String name) Cancel the activity: finishes the activity with the given task idvoid
Cancel the whole process.evaluateXPath
(String xpathExpression) Evaluates the given XPath 1.0 expression.void
executeReport
(String id, String action, String target) Execute a report and store the result document.void
exportDocument
(String docpath, String filepath) Copy a document form process folder to the file system.void
finishActivity
(String label) Finish a task, an andpar, orpar, or a parfor.void
fourEyesPrinciple
(String stepid) Check, if the current agent is not the agent of the step referenced by stepid.void
fourEyesPrinciple
(String stepid, ActivityInstance ai) Check, if the current agent is not the agent who did the last step instance of the step identified by the passed label.getFormFieldValue
(String formfield) Returns the value of a formfield.getPreviousAgent
(String stepid, String defaultId) Get the agent of a previous step (identified by its label).getPreviousAgent
(String stepid, String defaultId, ActivityInstance ai) void
Make a get request to a HTTP URL.void
increasePriority
(String offset) Increase the priority with an offset.boolean
Returns true, if there is an active or idle or suspended activity instance in the current process that has the task with the given id.boolean
isFalse()
Use as condition dummy, returns false.boolean
isStartAgent
(String formfield) This method returns true, if the formfield contains a user object and the user is the start agent of the current process.boolean
isTrue()
Use as condition dummy, always returns true.void
Expression in andjoin for implementing generalized andjoin.boolean
Add a lock to the process instance.boolean
Add a lock to the process instance.boolean
Writes the argument on the log.boolean
manualIf()
Use this method in a condition if you want to select the result manually.void
nop()
Use as system step dummy, does nothing.void
parforJoin
(String n, String mode) Expression in end parfor for implementing generalized parfor join.boolean
randomTrue
(String percent) Returns true randomly.void
sendMessage
(String templateid) Send a message using a pre-defined message template.void
setAgentFromField
(String formfield) Set the current agent from a form field.void
setDuedateFromField
(String formfield) Set the duedate of the current task to the value of the given form field.void
setFieldToAgent
(String formfield) Set a form field to the current user.void
setFieldToCurrentDate
(String formfield) Set a form field to the current date.void
setFieldToOU
(String formfield) Set a form field to the home org unit of agentvoid
setFieldToValue
(String formfield, String value) Set a form field to specified value.boolean
setOUFromField
(String formfield, String forProcess) Set the org-unit of the current activity and optionally the process (parent) of the activity from a form field.void
setProcessDuedateFromField
(String formfield) Set the duedate of the current process instance to the value of the given form field.startProcess
(String id, String orgUnit, String form1, String form2) Start a process.void
Suspend the current activity instance.boolean
Removes the lock.void
untake()
Untake the task.
-
Constructor Details
-
SystemAction
public SystemAction()
-
-
Method Details
-
lock
Add a lock to the process instance. Must be eventually unlocked viaunlock(String)
.- Parameters:
name
- name of the lock- Returns:
- always true
-
unlock
Removes the lock.- Parameters:
name
- name of the lock- Returns:
- always true
-
lockForCurrentTransaction
Add a lock to the process instance. Is automatically removed at transaction completion.- Parameters:
name
- name of the lock- Returns:
- always true
-
cancelActivity
Cancel the activity: finishes the activity with the given task id- Parameters:
name
- the id of a task
-
cancelProcess
public void cancelProcess()Cancel the whole process. Note, that this method will work in task preprocessing but cannot be used in a system step. -
autoTake
This method performs a take when the activity instance is assigned to a role and there is exactly one user having this role. Please take note of substitutions, because roles can be inherited!- Throws:
Exception
-
log
Writes the argument on the log.- Parameters:
message
- the messagelevel
- the log level: error, warn, info, debug, trace- Returns:
true
-
setFieldToAgent
Set a form field to the current user.- Parameters:
formfield
- the form field: formid "." fieldame
-
setFieldToOU
Set a form field to the home org unit of agent- Parameters:
formfield
- the form field: formid "." fieldame
-
setFieldToCurrentDate
Set a form field to the current date.- Parameters:
formfield
- the form field: formid "." fieldame
-
getFormFieldValue
Returns the value of a formfield.- Parameters:
formfield
- in the syntax formid "." fieldname- Returns:
- the value object
-
setFieldToValue
Set a form field to specified value.- Parameters:
formfield
- the form field: formid "." fieldname- Throws:
Exception
-
isStartAgent
This method returns true, if the formfield contains a user object and the user is the start agent of the current process.- Parameters:
formfield
- the form field in syntax: formid "." fieldame
-
isActive
Returns true, if there is an active or idle or suspended activity instance in the current process that has the task with the given id.- Parameters:
task
- the id of a task object- Returns:
- true if there is an active task
-
join
Expression in andjoin for implementing generalized andjoin.- Parameters:
n
- number of branches that must be completedmode
- either cancel or none. every other value is taken as none
-
parforJoin
Expression in end parfor for implementing generalized parfor join.- Parameters:
n
- number of branches that must be completedmode
- either cancel or none. every other value is taken as none
-
finishActivity
Finish a task, an andpar, orpar, or a parfor.- Parameters:
label
- the label of a step
-
setAgentFromField
Set the current agent from a form field.- Parameters:
formfield
- the form field: formid "." fieldame
-
isTrue
public boolean isTrue()Use as condition dummy, always returns true. -
isFalse
public boolean isFalse()Use as condition dummy, returns false. -
nop
public void nop()Use as system step dummy, does nothing. -
manualIf
public boolean manualIf()Use this method in a condition if you want to select the result manually. -
evaluateXPath
Evaluates the given XPath 1.0 expression.- Parameters:
xpathExpression
-- Returns:
- the result of the XPath-expression
-
increasePriority
Increase the priority with an offset. Can be used as escalation action. -
untake
public void untake()Untake the task. Can be used as escalation action for tasks. -
setDuedateFromField
Set the duedate of the current task to the value of the given form field.- Throws:
Exception
-
setProcessDuedateFromField
Set the duedate of the current process instance to the value of the given form field.- Throws:
Exception
-
fourEyesPrinciple
Check, if the current agent is not the agent of the step referenced by stepid. If the check fails an appropriate exception will be thrown.- Parameters:
stepid
- the id of the step to check
-
fourEyesPrinciple
Check, if the current agent is not the agent who did the last step instance of the step identified by the passed label. If the check fails an appropriate exception will be thrown.- Parameters:
stepid
- the label of the step to checkai
- the activity instance for which the check is performed
-
setOUFromField
Set the org-unit of the current activity and optionally the process (parent) of the activity from a form field.- Parameters:
formfield
- the form field: formid "." fieldame containing an org-unitforProcess
- if value is true the org-unit of the parent of the activity-instance is also set to the given org-unit
-
randomTrue
Returns true randomly.- Parameters:
percent
- either an integer number giving the percentage of true results or the name of a configuration parameter defining the percentage.- Returns:
-
sendMessage
Send a message using a pre-defined message template. The mail is sent in a separate transaction after commit of this one.- Parameters:
templateid
- the id of the message template- Throws:
Exception
-
getPreviousAgent
Get the agent of a previous step (identified by its label). If the step has not been executed before, use the defaultId - either a role or user id.- Parameters:
stepid
- label of a step in the processdefaultId
- role or user id- Returns:
- if a previous step is found, its agent else if the defaultId is not empty the defaultId else null.
-
getPreviousAgent
-
httpGet
Make a get request to a HTTP URL.- Parameters:
urlstr
- use substitutions like inreturnfield
- a form field to write the return value- Throws:
IOException
-
addSubform
Add a subform.- Parameters:
form
- id of the main formid
- id of the subform relation (parsed to an integer)- Throws:
Exception
-
suspend
Suspend the current activity instance. -
executeReport
Execute a report and store the result document. The process id is provided to the report as parameter "pid".- Parameters:
id
- id of reportaction
- email, dms or filetarget
- message template, dms folder, or path. if action is dms and no target is given, the target is the folder of the process instance.
-
startProcess
Start a process.- Parameters:
id
- the id of the process to startorgUnit
- the org-unit of the processform1
- a comma separated list of form fields of the current process: the values are copied to the respective fields in form2, subforms can be copied by specifying <formid>.<subformid>form2
- a comma separated list of formfields of the new process, leave it empty if it is the same as form1
-
exportDocument
Copy a document form process folder to the file system.- Parameters:
docpath
- path to a document of the processfilepath
- path in filesystem (absolute or relative to ep directory).- Throws:
Exception
-
addDocument
Add a document to the process folder.- Parameters:
origin
- dms or filefilepath
- path in filesystem or dms, seeDMS.getDMSObject(String)
for syntax of pathdocpath
- path to the document- Throws:
Exception
-
addFolder
add a folder to the process.- Parameters:
name
- name of the folder
-