Class ProcessInstanceImpl
- java.lang.Object
-
- org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<E,I>
-
- org.silverpeas.core.persistence.datasource.model.jpa.BasicJpaEntity<ProcessInstanceImpl,UniqueIntegerIdentifier>
-
- org.silverpeas.core.workflow.engine.instance.ProcessInstanceImpl
-
- All Implemented Interfaces:
Serializable
,IdentifiableEntity
,ProcessInstance
,UpdatableProcessInstance
@Entity public class ProcessInstanceImpl extends BasicJpaEntity<ProcessInstanceImpl,UniqueIntegerIdentifier> implements UpdatableProcessInstance
This class is one implementation of interface UpdatableProcessInstance.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ProcessInstanceImpl()
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addActiveState(State state)
Set a state active for this instancevoid
addActiveState(ActiveState activeState)
Add active state to the process instancevoid
addHistoryStep(HistoryStep step)
Add an history step for this instancevoid
addInterestedUser(Actor actor, State state)
void
addInterestedUser(User user, State state, String role)
Add an user in the interested user listState
addQuestion(String content, String stepId, State fromState, User fromUser)
Add a questionvoid
addQuestion(Question question)
Add a question for this instancevoid
addTimeout(State state)
void
addWorkingUser(Actor actor, State state)
void
addWorkingUser(User user, State state, String role)
Add an user in the working user listState
answerQuestion(String content, String questionId)
Answer a questionvoid
cancelQuestion(Question question)
Cancel a question without response 1 - make a fictive answer 2 - remove active state 3 - remove working user 4 - recurse in question target state, if questions have been asked in cascadevoid
computeValid()
boolean
equals(Object obj)
DataRecord
getActionRecord(String actionName)
Get the data associated to the given actionString[]
getActiveStates()
Actor[]
getActors(QualifiedUsers qualifiedUsers, State state)
Computes tuples role/user/state (stored in an Actor object) from a QualifiedUsers objectDataRecord
getAllDataRecord(String role, String lang)
Returns a data record with all the accessible data in this instance.String[]
getAssignedStates(User user, String roleName)
Returns all the state name assigned to the user.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()
Get the error status of this instanceField
getField(String fieldName)
Returns the required field from the folder.DataRecord
getFolder()
Returns the folder as a DataRecordDataRecord
getFormRecord(String formName, String role, String lang)
HistoryStep
getHistoryStep(String stepId)
HistoryStep[]
getHistorySteps()
String
getInstanceId()
Get the workflow instance idLockingUser
getLockingUser(String state)
String
getModelId()
Get the workflow model idHistoryStep
getMostRecentStep(String actionName)
Returns the most recent step where this action was performed.DataRecord
getNewActionRecord(String actionName, String language)
Get a new data record associated to the given actionParticipant
getParticipant(String resolvedState)
Get the last user who resolved the given stateList<Participant>
getParticipants()
Question[]
getPendingQuestions(String stateName)
Get all the questions asked to the given stateProcessModel
getProcessModel()
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 asweredDataRecord
getRowDataRecord(String role, String lang)
Returns a data record with all the main data in this instance.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)
Returns the timeout action to be launched after given dateboolean
getTimeoutStatus()
Get 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()
Returns all the working users on this instance.Actor[]
getWorkingUsers(String state)
Returns all the working users on this instance state.Actor[]
getWorkingUsers(String state, String role)
Returns all the working users on this instance state.int
hashCode()
boolean
isLockedByAdmin()
Get the lock Admin status of this instanceboolean
isStateInBackStatus(String stateName)
Test is a active state is in back statusboolean
isValid()
Get the validity state of this instancevoid
lock()
Lock this instance for the enginevoid
lock(State state, User user)
Locks this instance for the given instance and statevoid
reDoState(String state, Date actionDate)
Cancel all the atomic operations since the step where first action had occuredvoid
removeActiveState(State state)
Set a state inactive for this instancevoid
removeInterestedUser(User user, State state, String role)
Remove an user from the interested user listvoid
removeInterestedUsers(State state)
Remove all interested users for given statevoid
removeTimeout(State state)
void
removeWorkingUser(User user, State state, String role)
Remove an user from the working user listvoid
removeWorkingUsers(State state)
Remove all working users for given statevoid
saveActionRecord(HistoryStep step, DataRecord actionData)
Set the form associated to the given actionvoid
setErrorStatus(boolean errorStatus)
Set the error status of this instancevoid
setField(String fieldName, Field copiedField)
Update the named field with the value of the given field.void
setInstanceId(String instanceId)
Set the workflow instance idvoid
setLockedByAdmin(boolean locked)
Set the lock Admin status of this instancevoid
setModelId(String modelId)
Set the workflow model idvoid
setTimeoutStatus(boolean timeoutStatus)
Set the timeout status of this instancevoid
unLock()
Unlock this instance for the enginevoid
unLock(State state, User user)
Un-locks this instance for the given instance and statevoid
updateFolder(DataRecord actionData)
Updates the folder with the data filled within an action.void
updateHistoryStep(HistoryStep step)
Update an history step for this instance-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.BasicJpaEntity
performBeforePersist, performBeforeRemove, performBeforeUpdate
-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity
getId, getNativeId, isPersisted, setId
-
-
-
-
Method Detail
-
getInstanceId
public String getInstanceId()
Get the workflow instance id- Specified by:
getInstanceId
in interfaceProcessInstance
- Returns:
- instance id
-
setInstanceId
public void setInstanceId(String instanceId)
Set the workflow instance id- Specified by:
setInstanceId
in interfaceUpdatableProcessInstance
- Parameters:
instanceId
- instance id
-
getModelId
public String getModelId()
Get the workflow model id- Specified by:
getModelId
in interfaceProcessInstance
- Returns:
- model id
-
setModelId
public void setModelId(String modelId)
Set the workflow model id- Specified by:
setModelId
in interfaceUpdatableProcessInstance
- Parameters:
modelId
- model id
-
addHistoryStep
public void addHistoryStep(HistoryStep step)
Add an history step for this instance- Specified by:
addHistoryStep
in interfaceUpdatableProcessInstance
- Parameters:
step
- the history step to add
-
updateHistoryStep
public void updateHistoryStep(HistoryStep step)
Update an history step for this instance- Specified by:
updateHistoryStep
in interfaceUpdatableProcessInstance
- Parameters:
step
- the history step to update
-
addActiveState
public void addActiveState(State state)
Set a state active for this instance- Specified by:
addActiveState
in interfaceUpdatableProcessInstance
- Parameters:
state
- State to be activated
-
removeActiveState
public void removeActiveState(State state) throws WorkflowException
Set a state inactive for this instance- Specified by:
removeActiveState
in interfaceUpdatableProcessInstance
- Parameters:
state
- State to be desactivated- Throws:
WorkflowException
-
addTimeout
public void addTimeout(State state) throws WorkflowException
- Specified by:
addTimeout
in interfaceUpdatableProcessInstance
- Parameters:
state
-- Throws:
WorkflowException
-
removeTimeout
public void removeTimeout(State state) throws WorkflowException
- Specified by:
removeTimeout
in interfaceUpdatableProcessInstance
- Parameters:
state
-- Throws:
WorkflowException
-
addWorkingUser
public void addWorkingUser(User user, State state, String role) throws WorkflowException
Add an user in the working user list- Specified by:
addWorkingUser
in interfaceUpdatableProcessInstance
- Parameters:
user
- user to addstate
- state for which the user can make an actionrole
- role name under which the user can make an action- Throws:
WorkflowException
-
addWorkingUser
public void addWorkingUser(Actor actor, State state) throws WorkflowException
- Specified by:
addWorkingUser
in interfaceUpdatableProcessInstance
- Throws:
WorkflowException
-
removeWorkingUser
public void removeWorkingUser(User user, State state, String role) throws WorkflowException
Remove an user from the working user list- Specified by:
removeWorkingUser
in interfaceUpdatableProcessInstance
- Parameters:
user
- user to removestate
- state for which the user could make an actionrole
- role name under which the user could make an action- Throws:
WorkflowException
-
addInterestedUser
public void addInterestedUser(User user, State state, String role) throws WorkflowException
Add an user in the interested user list- Specified by:
addInterestedUser
in interfaceUpdatableProcessInstance
- Parameters:
user
- user to addstate
- state for which the user is interestedrole
- role name under which the user is interested- Throws:
WorkflowException
-
addInterestedUser
public void addInterestedUser(Actor actor, State state) throws WorkflowException
- Specified by:
addInterestedUser
in interfaceUpdatableProcessInstance
- Throws:
WorkflowException
-
removeInterestedUser
public void removeInterestedUser(User user, State state, String role) throws WorkflowException
Remove an user from the interested user list- Specified by:
removeInterestedUser
in interfaceUpdatableProcessInstance
- Parameters:
user
- user to removestate
- state for which the user is interestedrole
- role name under which the user is interested- Throws:
WorkflowException
-
addQuestion
public void addQuestion(Question question)
Add a question for this instance- Parameters:
question
- the question to add- Throws:
WorkflowException
-
computeValid
public void computeValid()
- Specified by:
computeValid
in interfaceUpdatableProcessInstance
-
getProcessModel
public ProcessModel getProcessModel() throws WorkflowException
- Specified by:
getProcessModel
in interfaceProcessInstance
- Returns:
- ProcessModel
- Throws:
WorkflowException
-
getHistorySteps
public HistoryStep[] getHistorySteps()
- Specified by:
getHistorySteps
in interfaceProcessInstance
- Returns:
- HistoryStep[]
-
getHistoryStep
public HistoryStep getHistoryStep(String stepId) throws WorkflowException
- Specified by:
getHistoryStep
in interfaceProcessInstance
- Returns:
- HistoryStep
- Throws:
WorkflowException
-
getParticipants
public List<Participant> getParticipants() throws WorkflowException
- Specified by:
getParticipants
in interfaceProcessInstance
- Returns:
- Vector
- Throws:
WorkflowException
-
getParticipant
public Participant getParticipant(String resolvedState) throws WorkflowException
Get the last user who resolved the given state- Specified by:
getParticipant
in interfaceProcessInstance
- Parameters:
resolvedState
- the resolved state- Returns:
- this user as a Participant object
- Throws:
WorkflowException
-
getFolder
public DataRecord getFolder() throws WorkflowException
Returns the folder as a DataRecord- Specified by:
getFolder
in interfaceProcessInstance
- Returns:
- DataRecord
- Throws:
WorkflowException
-
getAllDataRecord
public DataRecord getAllDataRecord(String role, String lang) throws WorkflowException
Returns a data record with all the accessible data in this instance.- Specified by:
getAllDataRecord
in interfaceProcessInstance
- Returns:
- DataRecord
- Throws:
WorkflowException
-
getRowDataRecord
public DataRecord getRowDataRecord(String role, String lang) throws WorkflowException
Returns a data record with all the main data in this instance.- Specified by:
getRowDataRecord
in interfaceProcessInstance
- Throws:
WorkflowException
-
updateFolder
public void updateFolder(DataRecord actionData) throws WorkflowException
Updates the folder with the data filled within an action.- Specified by:
updateFolder
in interfaceProcessInstance
- Throws:
WorkflowException
-
getField
public Field getField(String fieldName) throws WorkflowException
Returns the required field from the folder.- Specified by:
getField
in interfaceProcessInstance
- Parameters:
fieldName
- the fieldName that identifies the Field instance to get- Returns:
- Field
- Throws:
WorkflowException
-
setField
public void setField(String fieldName, Field copiedField) throws WorkflowException
Update the named field with the value of the given field.- Specified by:
setField
in interfaceUpdatableProcessInstance
- Parameters:
fieldName
-copiedField
-- Throws:
WorkflowException
-
getActionRecord
public DataRecord getActionRecord(String actionName) throws WorkflowException
Get the data associated to the given action- Specified by:
getActionRecord
in interfaceProcessInstance
- Parameters:
actionName
- action name- Returns:
- Throws:
WorkflowException
-
getFormRecord
public DataRecord getFormRecord(String formName, String role, String lang) throws WorkflowException
- Specified by:
getFormRecord
in interfaceProcessInstance
- Parameters:
formName
-role
-lang
-- Returns:
- DataRecord
- Throws:
WorkflowException
-
getNewActionRecord
public DataRecord getNewActionRecord(String actionName, String language) throws WorkflowException
Get a new data record associated to the given action- Specified by:
getNewActionRecord
in interfaceProcessInstance
- Parameters:
actionName
- action name- Returns:
- Throws:
WorkflowException
-
saveActionRecord
public void saveActionRecord(HistoryStep step, DataRecord actionData) throws WorkflowException
Set the form associated to the given action- Specified by:
saveActionRecord
in interfaceUpdatableProcessInstance
- Parameters:
step
-actionData
-- Throws:
WorkflowException
-
getMostRecentStep
public HistoryStep getMostRecentStep(String actionName)
Returns the most recent step where this action was performed.- Specified by:
getMostRecentStep
in interfaceProcessInstance
-
getSavedStep
public HistoryStep getSavedStep(String userId) throws WorkflowException
Get step saved by given user id.- Specified by:
getSavedStep
in interfaceProcessInstance
- Throws:
WorkflowException
-
getActiveStates
public String[] getActiveStates()
- Specified by:
getActiveStates
in interfaceProcessInstance
- Returns:
- String[]
-
isStateInBackStatus
public boolean isStateInBackStatus(String stateName)
Test is a active state is in back status- Specified by:
isStateInBackStatus
in interfaceProcessInstance
- Parameters:
stateName
- name of active state- Returns:
- true if resolution of active state involves a cancel of actions
-
getWorkingUsers
public Actor[] getWorkingUsers() throws WorkflowException
Description copied from interface:ProcessInstance
Returns all the working users on this instance.- Specified by:
getWorkingUsers
in interfaceProcessInstance
- Returns:
- Actor[]
- Throws:
WorkflowException
-
getWorkingUsers
public Actor[] getWorkingUsers(String state) throws WorkflowException
Description copied from interface:ProcessInstance
Returns all the working users on this instance state.- Specified by:
getWorkingUsers
in interfaceProcessInstance
- Parameters:
state
-- Returns:
- Actor[]
- Throws:
WorkflowException
-
removeWorkingUsers
public void removeWorkingUsers(State state) throws WorkflowException
Description copied from interface:UpdatableProcessInstance
Remove all working users for given state- Specified by:
removeWorkingUsers
in interfaceUpdatableProcessInstance
- Parameters:
state
- state for which the user is interested- Throws:
WorkflowException
-
removeInterestedUsers
public void removeInterestedUsers(State state) throws WorkflowException
Description copied from interface:UpdatableProcessInstance
Remove all interested users for given state- Specified by:
removeInterestedUsers
in interfaceUpdatableProcessInstance
- Parameters:
state
- state for which the user is interested- Throws:
WorkflowException
-
getWorkingUsers
public Actor[] getWorkingUsers(String state, String role) throws WorkflowException
Description copied from interface:ProcessInstance
Returns all the working users on this instance state.- Specified by:
getWorkingUsers
in interfaceProcessInstance
- Parameters:
state
-- Returns:
- Actor[]
- Throws:
WorkflowException
-
getAssignedStates
public String[] getAssignedStates(User user, String roleName)
Returns all the state name assigned to the user.- Specified by:
getAssignedStates
in interfaceProcessInstance
- Returns:
- String[]
-
getLockingUser
public LockingUser getLockingUser(String state) throws WorkflowException
- Specified by:
getLockingUser
in interfaceProcessInstance
- Parameters:
state
-- Returns:
- LockingUser
- Throws:
WorkflowException
-
lock
public void lock(State state, User user) throws WorkflowException
Locks this instance for the given instance and state- Specified by:
lock
in interfaceProcessInstance
- Parameters:
state
- state that have to be lockeduser
- the locking user- Throws:
WorkflowException
-
unLock
public void unLock(State state, User user) throws WorkflowException
Un-locks this instance for the given instance and state- Specified by:
unLock
in interfaceProcessInstance
- Parameters:
state
- state that have to be un-lockeduser
- the current locking user- Throws:
WorkflowException
-
lock
public void lock() throws WorkflowException
Lock this instance for the engine- Specified by:
lock
in interfaceUpdatableProcessInstance
- Throws:
WorkflowException
-
unLock
public void unLock() throws WorkflowException
Unlock this instance for the engine- Specified by:
unLock
in interfaceUpdatableProcessInstance
- Throws:
WorkflowException
-
isValid
public boolean isValid()
Get the validity state of this instance- Specified by:
isValid
in interfaceProcessInstance
- Returns:
- true is this instance is valid
-
isLockedByAdmin
public boolean isLockedByAdmin()
Get the lock Admin status of this instance- Specified by:
isLockedByAdmin
in interfaceProcessInstance
- Returns:
- true is this instance is locked by admin
-
setLockedByAdmin
public void setLockedByAdmin(boolean locked)
Set the lock Admin status of this instance- Parameters:
locked
- true is this instance is locked by admin
-
getErrorStatus
public boolean getErrorStatus()
Get the error status of this instance- Specified by:
getErrorStatus
in interfaceProcessInstance
- Returns:
- true if this instance is in error
-
setErrorStatus
public void setErrorStatus(boolean errorStatus)
Set the error status of this instance- Specified by:
setErrorStatus
in interfaceUpdatableProcessInstance
- Parameters:
errorStatus
- true if this instance is in error
-
getTimeoutStatus
public boolean getTimeoutStatus()
Get the timeout status of this instance- Specified by:
getTimeoutStatus
in interfaceProcessInstance
- Returns:
- true if this instance is in an active state for a long long time
-
setTimeoutStatus
public void setTimeoutStatus(boolean timeoutStatus)
Set the timeout status of this instance- Specified by:
setTimeoutStatus
in interfaceUpdatableProcessInstance
- Parameters:
timeoutStatus
- true if this instance is in an active state for a long long time
-
getUsersInRole
public List<User> getUsersInRole(String role) throws WorkflowException
Description copied from interface:ProcessInstance
Gets concrete users affected to given role at runtime- Specified by:
getUsersInRole
in interfaceProcessInstance
- Parameters:
role
- the name of the role- Returns:
- users affected to given role
- Throws:
WorkflowException
-
getUsersInGroup
public List<User> getUsersInGroup(String groupId) throws WorkflowException
Description copied from interface:ProcessInstance
Gets concrete users affected to given group at runtime- Specified by:
getUsersInGroup
in interfaceProcessInstance
- Parameters:
groupId
- the id of the group- Returns:
- users in given group
- Throws:
WorkflowException
-
getActors
public Actor[] getActors(QualifiedUsers qualifiedUsers, State state) throws WorkflowException
Computes tuples role/user/state (stored in an Actor object) from a QualifiedUsers object- Specified by:
getActors
in interfaceProcessInstance
- 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
-
reDoState
public void reDoState(String state, Date actionDate) throws WorkflowException
Cancel all the atomic operations since the step where first action had occured- Specified by:
reDoState
in interfaceUpdatableProcessInstance
- Parameters:
state
- the name of state where ac action has been discussedactionDate
- date of state re-resolving- Throws:
WorkflowException
-
getBackSteps
public 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- Specified by:
getBackSteps
in interfaceProcessInstance
- 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
public State addQuestion(String content, String stepId, State fromState, User fromUser) throws WorkflowException
Add a question- Specified by:
addQuestion
in interfaceProcessInstance
- 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
public State answerQuestion(String content, String questionId) throws WorkflowException
Answer a question- Specified by:
answerQuestion
in interfaceProcessInstance
- Parameters:
content
- response textquestionId
- id of question corresponding to this response- Returns:
- The state where the question was asked
- Throws:
WorkflowException
-
getPendingQuestions
public Question[] getPendingQuestions(String stateName)
Get all the questions asked to the given state- Specified by:
getPendingQuestions
in interfaceProcessInstance
- Parameters:
stateName
- given state name- Returns:
- all the questions (not yet answered) asked to the given state
-
getSentQuestions
public Question[] getSentQuestions(String stateName)
Get all the questions asked from the given state- Specified by:
getSentQuestions
in interfaceProcessInstance
- Parameters:
stateName
- given state name- Returns:
- all the questions (not yet answered) asked from the given state
-
getRelevantQuestions
public Question[] getRelevantQuestions(String stateName)
Get all the questions asked from the given state and that have been aswered- Specified by:
getRelevantQuestions
in interfaceProcessInstance
- Parameters:
stateName
- given state name- Returns:
- all the answered questions asked from the given state
-
cancelQuestion
public void cancelQuestion(Question question) throws WorkflowException
Cancel a question without response 1 - make a fictive answer 2 - remove active state 3 - remove working user 4 - recurse in question target state, if questions have been asked in cascade- Specified by:
cancelQuestion
in interfaceUpdatableProcessInstance
- Parameters:
question
- the question to cancel- Throws:
WorkflowException
-
getQuestions
public Question[] getQuestions()
Get all the questions asked in this processInstance- Specified by:
getQuestions
in interfaceProcessInstance
- Returns:
- all the questions
-
addActiveState
public void addActiveState(ActiveState activeState)
Add active state to the process instance- Parameters:
activeState
- state to add.
-
getTitle
public String getTitle(String role, String lang)
Returns this instance title.- Specified by:
getTitle
in interfaceProcessInstance
- Parameters:
role
-lang
-- Returns:
-
getTimeOutAction
public ActionAndState getTimeOutAction(Date dateRef) throws WorkflowException
Returns the timeout action to be launched after given date- Specified by:
getTimeOutAction
in interfaceProcessInstance
- Throws:
WorkflowException
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classAbstractJpaEntity<ProcessInstanceImpl,UniqueIntegerIdentifier>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractJpaEntity<ProcessInstanceImpl,UniqueIntegerIdentifier>
-
-