Interface ProcessInstance
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
UpdatableProcessInstance
- All Known Implementing Classes:
ProcessInstanceImpl
public interface ProcessInstance extends Serializable
A process instance spawned from a given process model. The process model defines the workflow. Each process instance is made up of states and actions through which the process instance changes of states. The current(s) state(s) at which is a process instance are the active states. A process instance can have several active parallel states.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description State
addQuestion(String content, String stepId, State fromState, User fromUser)
Add a questionState
answerQuestion(String content, String questionId)
Answer a questionDataRecord
getActionRecord(String actionName)
Gets the data that were provided to the specified action when it was was performed.String[]
getActiveStates()
Gets all the active states of this process instance.Actor[]
getActors(QualifiedUsers qualifiedUsers, State state)
Computes tuples role/user (stored in an Actor object) from a QualifiedUsers objectString[]
getAllAssignedStates(User user)
Gets all the states that are assigned to the specified user.DataRecord
getAllDataRecord(String role, String lang)
String[]
getAssignedStates(User user, String roleName)
Gets all the states that are assigned to the specified user with given role.HistoryStep[]
getBackSteps(User user, String roleName, String stateName)
Get all the steps where given user (with given role) can go back from the given stateboolean
getErrorStatus()
Is this process instance in error by an action?Field
getField(String fieldName)
Gets the specified field.DataRecord
getFolder()
Gets the folder of this process instance.DataRecord
getFormRecord(String formName, String role, String lang)
Gets the data record of the specified form for the given role and written in the specified language.HistoryStep
getHistoryStep(String stepId)
Gets the step with the specified identifier in the history of this process instance.HistoryStep[]
getHistorySteps()
Gets the different steps in the history of this process instance.String
getInstanceId()
Get the workflow instance idLockingUser
getLockingUser(String state)
Gets the user that has locked the specified state.String
getModelId()
Get the workflow model idHistoryStep
getMostRecentStep(String actionName)
Recent the most recent step where the named action has been performed.DataRecord
getNewActionRecord(String actionName, String language)
Gets a new data record associated with the given action.Participant
getParticipant(String resolvedState)
Get the last user who resolved the given stateList<Participant>
getParticipants()
Gets all the participants in this process instance.Question[]
getPendingQuestions(String stateName)
Get all the questions asked in the given stateProcessModel
getProcessModel()
Gets the model of the process from which it was spawned.Question[]
getQuestions()
Get all the questions asked in this processInstanceQuestion[]
getRelevantQuestions(String stateName)
Get all the questions asked from the given state and that have been answeredDataRecord
getRowDataRecord(String role, String lang)
Gets a data record which will be used to render this process instance as a row in a list of process instances.HistoryStep
getSavedStep(String userId)
Get step saved by given user id.Question[]
getSentQuestions(String stateName)
Get all the questions asked from the given stateActionAndState
getTimeOutAction(Date dateRef)
Gets the timeout action to be launched after the given datetime.boolean
getTimeoutStatus()
Gets the timeout status of this instanceString
getTitle(String role, String lang)
Returns this instance title.List<User>
getUsersInGroup(String groupId)
Gets concrete users affected to given group at runtimeList<User>
getUsersInRole(String role)
Gets concrete users affected to given role at runtimeActor[]
getWorkingUsers()
Gets all the users working on this process instance.Actor[]
getWorkingUsers(String state)
Gets all the users working on the specified state of this instance state.Actor[]
getWorkingUsers(String state, String role)
Gets all the users working on the specified state of this instance state with the given role.boolean
isLockedByAdmin()
Is this process instance has been locked by the supervisor?boolean
isStateInBackStatus(String stateName)
Test is a active state is in back statusboolean
isValid()
Is this process instance valid?void
lock(State state, User user)
Locks this instance for the given instance and statevoid
unLock(State state, User user)
Un-locks this instance for the given instance and statevoid
updateFolder(DataRecord data)
Updates the folder of this process instance with the specified one.
-
-
-
Method Detail
-
getProcessModel
ProcessModel getProcessModel() throws WorkflowException
Gets the model of the process from which it was spawned.- Returns:
- the
ProcessModel
of this process instance. - Throws:
WorkflowException
-
getInstanceId
String getInstanceId()
Get the workflow instance id- Returns:
- instance id
-
getModelId
String getModelId()
Get the workflow model id- Returns:
- model id
-
getHistorySteps
HistoryStep[] getHistorySteps()
Gets the different steps in the history of this process instance. A history step defines the change of a state by an action performed by a given working user.- Returns:
- an array of
HistoryStep
objects.
-
getHistoryStep
HistoryStep getHistoryStep(String stepId) throws WorkflowException
Gets the step with the specified identifier in the history of this process instance.- Parameters:
stepId
- the unique identifier of a history step.- Returns:
- the asked history step.
- Throws:
WorkflowException
- if no such history step can be found.
-
getActionRecord
DataRecord getActionRecord(String actionName) throws WorkflowException
Gets the data that were provided to the specified action when it was was performed. The most recent data is returned in the case the action has been done several times.- Parameters:
actionName
- action name the name of the performed action.- Returns:
- the data record.
- Throws:
WorkflowException
-
getNewActionRecord
DataRecord getNewActionRecord(String actionName, String language) throws WorkflowException
Gets a new data record associated with the given action.- Parameters:
actionName
- action namelanguage
- the ISO-631 code of the language in which the data will be.- Returns:
- the new empty data record.
- Throws:
WorkflowException
-
getParticipants
List<Participant> getParticipants() throws WorkflowException
Gets all the participants in this process instance.- Returns:
- the list of participants in this process instance.
- Throws:
WorkflowException
- if an error occurs.
-
getParticipant
Participant getParticipant(String resolvedState) throws WorkflowException
Get the last user who resolved the given state- Parameters:
resolvedState
- the resolved state- Returns:
- the user as a
Participant
object - Throws:
WorkflowException
- if an error occurs.
-
getFolder
DataRecord getFolder() throws WorkflowException
Gets the folder of this process instance.- Returns:
- the folder as a
DataRecord
object. - Throws:
WorkflowException
- if an error occurs.
-
updateFolder
void updateFolder(DataRecord data) throws WorkflowException
Updates the folder of this process instance with the specified one.- Parameters:
data
- the data record with which the folder has to be updated.- Throws:
WorkflowException
- if the update fails.
-
getAllDataRecord
DataRecord getAllDataRecord(String role, String lang) throws WorkflowException
- Parameters:
role
- a role a user can play in this process instance.lang
- the ISO-631 code of a language in which data have to be.- Returns:
- a record with all the data.
- Throws:
WorkflowException
- if an error occurs.
-
getRowDataRecord
DataRecord getRowDataRecord(String role, String lang) throws WorkflowException
Gets a data record which will be used to render this process instance as a row in a list of process instances. The information set in the record are filtered by what is allowed to be rendered for the given role.- Parameters:
role
- a role a user can play in this process instance.lang
- the ISO-631 code of the language in which data have to be.- Throws:
WorkflowException
- if an error occurs.
-
getFormRecord
DataRecord getFormRecord(String formName, String role, String lang) throws WorkflowException
Gets the data record of the specified form for the given role and written in the specified language. The information set in the record are filtered by what is allowed to be accessed for the given role.- Parameters:
formName
- the name of the form to get.role
- a role a user can play in this process instance.lang
- the ISO-631 code of the language in which data have to be.- Returns:
- DataRecord or null if no such form can be found.
- Throws:
WorkflowException
- if an error occurs.
-
getField
Field getField(String fieldName) throws WorkflowException
Gets the specified field.- Parameters:
fieldName
- the name that identifies a field in this process instance.- Returns:
- the corresponding field.
- Throws:
WorkflowException
- if the field cannot be found or if an error occurs.
-
getActiveStates
String[] getActiveStates()
Gets all the active states of this process instance. An active state is the current state at which the process is and waiting for actions.- Returns:
- an array with the name of all the active states.
-
getWorkingUsers
Actor[] getWorkingUsers() throws WorkflowException
Gets all the users working on this process instance.- Returns:
- an array of
Actor
objects. - Throws:
WorkflowException
- if an error occurs.
-
getWorkingUsers
Actor[] getWorkingUsers(String state) throws WorkflowException
Gets all the users working on the specified state of this instance state.- Parameters:
state
- the name of a state in this process instance.- Returns:
- an array of
Actor
objects. - Throws:
WorkflowException
-
getWorkingUsers
Actor[] getWorkingUsers(String state, String role) throws WorkflowException
Gets all the users working on the specified state of this instance state with the given role.- Parameters:
state
- the name of a state in this process instance.- Returns:
- an array of
Actor
objects. - Throws:
WorkflowException
-
getAssignedStates
String[] getAssignedStates(User user, String roleName)
Gets all the states that are assigned to the specified user with given role.- Parameters:
user
- a user in the workflow.roleName
- a role the user has to play in this process instance.- Returns:
- an array with the name of all the states assigned to the given user with the given role name.
-
getAllAssignedStates
String[] getAllAssignedStates(User user)
Gets all the states that are assigned to the specified user.- Parameters:
user
- a user in the workflow.- Returns:
- an array with the name of all the states assigned to the given user
-
getLockingUser
LockingUser getLockingUser(String state)
Gets the user that has locked the specified state.- Parameters:
state
- the name of a state in this process instance.- Returns:
- the user as a
LockingUser
instance.
-
isValid
boolean isValid()
Is this process instance valid?- Returns:
- true is this instance is valid. False otherwise.
-
isLockedByAdmin
boolean isLockedByAdmin()
Is this process instance has been locked by the supervisor?- Returns:
- true is this instance is locked by admin, false otherwise.
-
getErrorStatus
boolean getErrorStatus()
Is this process instance in error by an action?- Returns:
- true if this instance is in error, false otherwise.
-
getTimeoutStatus
boolean getTimeoutStatus()
Gets the timeout status of this instance- Returns:
- true if this instance is in an active state for a long long time. False otherwise.
-
lock
void lock(State state, User user) throws WorkflowException
Locks this instance for the given instance and state- Parameters:
state
- state that have to be lockeduser
- the locking user- Throws:
WorkflowException
-
unLock
void unLock(State state, User user) throws WorkflowException
Un-locks this instance for the given instance and state- Parameters:
state
- state that have to be un-lockeduser
- the unlocking user- Throws:
WorkflowException
-
getUsersInRole
List<User> getUsersInRole(String role) throws WorkflowException
Gets concrete users affected to given role at runtime- Parameters:
role
- the name of the role- Returns:
- users affected to given role
- Throws:
WorkflowException
- if an error occurs.
-
getUsersInGroup
List<User> getUsersInGroup(String groupId) throws WorkflowException
Gets concrete users affected to given group at runtime- Parameters:
groupId
- the id of the group- Returns:
- users in given group
- Throws:
WorkflowException
- if an error occurs
-
getActors
Actor[] getActors(QualifiedUsers qualifiedUsers, State state) throws WorkflowException
Computes tuples role/user (stored in an Actor object) from a QualifiedUsers object- Parameters:
qualifiedUsers
- Users defined by their role or by a relation with a participantstate
- state for which these user were/may be actors- Returns:
- tuples role/user as an array of Actor objects
- Throws:
WorkflowException
- if an error occurs
-
isStateInBackStatus
boolean isStateInBackStatus(String stateName)
Test is a active state is in back status- Parameters:
stateName
- name of active state- Returns:
- true if resolution of active state involves a cancel of actions
-
getSavedStep
HistoryStep getSavedStep(String userId) throws WorkflowException
Get step saved by given user id.- Returns:
- the history step or null if there is no such step.
- Throws:
WorkflowException
- if an error occurs.
-
getMostRecentStep
HistoryStep getMostRecentStep(String actionName)
Recent the most recent step where the named action has been performed.
-
getBackSteps
HistoryStep[] getBackSteps(User user, String roleName, String stateName) throws WorkflowException
Get all the steps where given user (with given role) can go back from the given state- Parameters:
user
- user that can do the back actionsroleName
- role name of this userstateName
- name of state where user want to go back from- Returns:
- an array of HistoryStep objects
- Throws:
WorkflowException
-
addQuestion
State addQuestion(String content, String stepId, State fromState, User fromUser) throws WorkflowException
Add a question- Parameters:
content
- question textstepId
- id of destination step for the questionfromState
- the state where the question was askedfromUser
- the user who asked the question- Returns:
- The state to which the question is
- Throws:
WorkflowException
-
answerQuestion
State answerQuestion(String content, String questionId) throws WorkflowException
Answer a question- Parameters:
content
- response textquestionId
- id of question corresponding to this response- Returns:
- The state where the question was asked
- Throws:
WorkflowException
-
getPendingQuestions
Question[] getPendingQuestions(String stateName) throws WorkflowException
Get all the questions asked in the given state- Parameters:
stateName
- given state name- Returns:
- all the questions (not yet answered) asked in the given state
- Throws:
WorkflowException
-
getSentQuestions
Question[] getSentQuestions(String stateName)
Get all the questions asked from the given state- Parameters:
stateName
- given state name- Returns:
- all the questions (not yet answered) asked from the given state
-
getRelevantQuestions
Question[] getRelevantQuestions(String stateName)
Get all the questions asked from the given state and that have been answered- Parameters:
stateName
- given state name- Returns:
- all the answered questions asked from the given state
-
getQuestions
Question[] getQuestions()
Get all the questions asked in this processInstance- Returns:
- all the questions
-
getTimeOutAction
ActionAndState getTimeOutAction(Date dateRef) throws WorkflowException
Gets the timeout action to be launched after the given datetime.- Returns:
- the asked
ActionAndState
or null if no such action is found. - Throws:
WorkflowException
- if an error occurs
-
-