|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.silverpeas.workflow.engine.instance.ProcessInstanceImpl
public class ProcessInstanceImpl
This class is one implementation of interface UpdatableProcessInstance. It uses Castor library to read/write process instance information in database
Constructor Summary | |
---|---|
ProcessInstanceImpl()
Default constructor |
Method Summary | |
---|---|
void |
addActiveState(State state)
Set a state active for this instance |
void |
addHistoryStep(HistoryStep step)
Add an history step for this instance |
void |
addInterestedUser(Actor actor,
State state)
|
void |
addInterestedUser(User user,
State state,
String role)
Add an user in the interested user list |
void |
addQuestion(Question question)
Add a question for this instance |
State |
addQuestion(String content,
String stepId,
State fromState,
User fromUser)
Add a question |
void |
addTimeout(State state)
|
void |
addWorkingUser(Actor actor,
State state)
|
void |
addWorkingUser(User user,
State state,
String role)
Add an user in the working user list |
State |
answerQuestion(String content,
String questionId)
Answer a question |
void |
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 cascade |
Vector<ActiveState> |
castor_getActiveStates()
Get states that are due to be resolved for this process instance |
Vector |
castor_getHistorySteps()
Get the instance history steps |
Vector<InterestedUser> |
castor_getInterestedUsers()
Get users who can see this process instance |
Vector<LockingUser> |
castor_getLockingUsers()
Get users who have locked a state of this process instance |
Vector<Question> |
castor_getQuestions()
Get the instance questions |
Vector<WorkingUser> |
castor_getWorkingUsers()
Get users who can act on this process instance |
void |
castor_setActiveStates(Vector<ActiveState> activeStates)
Set states that are due to be resolved for this process instance |
void |
castor_setHistorySteps(Vector historySteps)
Set the instance history steps |
void |
castor_setInterestedUsers(Vector<InterestedUser> interestedUsers)
Set users who can see this process instance |
void |
castor_setLockingUsers(Vector<LockingUser> lockingUsers)
Set users who have locked a state of this process instance |
void |
castor_setQuestions(Vector<Question> questions)
Set the instance questions |
void |
castor_setWorkingUsers(Vector<WorkingUser> workingUsers)
Set users who can act on this process instance |
void |
computeValid()
|
String |
create()
Creates this instance in database |
void |
delete()
Permanently removes this instance from database |
boolean |
equals(Object obj)
|
DataRecord |
getActionRecord(String actionName)
Get the data associated to the given action |
String[] |
getActiveStates()
|
Actor[] |
getActors(QualifiedUsers qualifiedUsers,
State state)
Computes tuples role/user/state (stored in an Actor object) from a QualifiedUsers object |
DataRecord |
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 state |
boolean |
getErrorStatus()
Get the error status of this instance |
int |
getErrorStatusCastor()
|
Field |
getField(String fieldName)
Returns the required field from the folder. |
DataRecord |
getFolder()
Returns the folder as a DataRecord |
DataRecord |
getFormRecord(String formName,
String role,
String lang)
|
HistoryStep |
getHistoryStep(String stepId)
|
HistoryStep[] |
getHistorySteps()
|
String |
getInstanceId()
Get the workflow instance id |
LockingUser |
getLockingUser(String state)
|
String |
getModelId()
Get the workflow model id |
HistoryStep |
getMostRecentStep(State state)
Get the most recent step where an action has been performed on the given state. |
HistoryStep |
getMostRecentStep(String actionName)
Returns the most recent step where this action was performed. |
DataRecord |
getNewActionRecord(String actionName)
Get a new data record associated to the given action |
Participant |
getParticipant(String resolvedState)
Get the last user who resolved the given state |
Vector<Participant> |
getParticipants()
|
Question[] |
getPendingQuestions(String stateName)
Get all the questions asked to the given state |
ProcessModel |
getProcessModel()
|
Question[] |
getQuestions()
Get all the questions asked in this processInstance |
Question[] |
getRelevantQuestions(String stateName)
Get all the questions asked from the given state and that have been aswered |
DataRecord |
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 state |
ActionAndState |
getTimeOutAction(Date dateRef)
Returns the timeout action to be launched after given date |
boolean |
getTimeoutStatus()
Get the timeout status of this instance |
int |
getTimeoutStatusCastor()
|
String |
getTitle(String role,
String lang)
Returns this instance title. |
List<User> |
getUsersInGroup(String groupId)
Gets concrete users affected to given group at runtime |
List<User> |
getUsersInRole(String role)
Gets concrete users affected to given role at runtime |
Actor[] |
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 instance |
int |
isLockedByAdminCastor()
|
boolean |
isStateInBackStatus(String stateName)
Test is a active state is in back status |
boolean |
isValid()
Get the validity state of this instance |
void |
lock()
Lock this instance for the engine |
void |
lock(State state,
User user)
Locks this instance for the given instance and state |
void |
reDoState(String state,
Date actionDate)
Cancel all the atomic operations since the step where first action had occured |
void |
removeActiveState(State state)
Set a state inactive for this instance |
void |
removeInterestedUser(User user,
State state,
String role)
Remove an user from the interested user list |
void |
removeInterestedUsers(State state)
Remove all interested users for given state |
void |
removeTimeout(State state)
|
void |
removeWorkingUser(User user,
State state,
String role)
Remove an user from the working user list |
void |
removeWorkingUsers(State state)
Remove all working users for given state |
void |
saveActionRecord(HistoryStep step,
DataRecord actionData)
Set the form associated to the given action |
void |
setErrorStatus(boolean errorStatus)
Set the error status of this instance |
void |
setErrorStatusCastor(int errorStatus)
|
void |
setField(String fieldName,
Field copiedField)
Update the named field with the value of the given field. |
void |
setInstanceId(String instanceId)
Set the workflow instance id |
void |
setLockedByAdmin(boolean locked)
Set the lock Admin status of this instance |
void |
setLockedByAdminCastor(int locked)
|
void |
setModelId(String modelId)
Set the workflow model id |
void |
setTimeoutStatus(boolean timeoutStatus)
Set the timeout status of this instance |
void |
setTimeoutStatusCastor(int timeoutStatus)
|
void |
unLock()
Unlock this instance for the engine |
void |
unLock(State state,
User user)
Un-locks this instance for the given instance and state |
void |
update()
Store modifications of this instance in database |
void |
updateHistoryStep(HistoryStep step)
Update an history step for this instance |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProcessInstanceImpl()
Method Detail |
---|
public String getInstanceId()
getInstanceId
in interface ProcessInstance
public void setInstanceId(String instanceId)
setInstanceId
in interface UpdatableProcessInstance
instanceId
- instance idpublic String getModelId()
getModelId
in interface ProcessInstance
public void setModelId(String modelId)
setModelId
in interface UpdatableProcessInstance
modelId
- model idpublic void addHistoryStep(HistoryStep step) throws WorkflowException
addHistoryStep
in interface UpdatableProcessInstance
step
- the history step to add
WorkflowException
public void updateHistoryStep(HistoryStep step) throws WorkflowException
updateHistoryStep
in interface UpdatableProcessInstance
step
- the history step to update
WorkflowException
public void addActiveState(State state) throws WorkflowException
addActiveState
in interface UpdatableProcessInstance
state
- State to be activated
WorkflowException
public void removeActiveState(State state) throws WorkflowException
removeActiveState
in interface UpdatableProcessInstance
state
- State to be desactivated
WorkflowException
public void addTimeout(State state) throws WorkflowException
addTimeout
in interface UpdatableProcessInstance
state
-
WorkflowException
public void removeTimeout(State state) throws WorkflowException
removeTimeout
in interface UpdatableProcessInstance
state
-
WorkflowException
public void addWorkingUser(User user, State state, String role) throws WorkflowException
addWorkingUser
in interface UpdatableProcessInstance
user
- user to addstate
- state for which the user can make an actionrole
- role name under which the user can make an action
WorkflowException
public void addWorkingUser(Actor actor, State state) throws WorkflowException
addWorkingUser
in interface UpdatableProcessInstance
WorkflowException
public void removeWorkingUser(User user, State state, String role) throws WorkflowException
removeWorkingUser
in interface UpdatableProcessInstance
user
- user to removestate
- state for which the user could make an actionrole
- role name under which the user could make an action
WorkflowException
public void addInterestedUser(User user, State state, String role) throws WorkflowException
addInterestedUser
in interface UpdatableProcessInstance
user
- user to addstate
- state for which the user is interestedrole
- role name under which the user is interested
WorkflowException
public void addInterestedUser(Actor actor, State state) throws WorkflowException
addInterestedUser
in interface UpdatableProcessInstance
WorkflowException
public void removeInterestedUser(User user, State state, String role) throws WorkflowException
removeInterestedUser
in interface UpdatableProcessInstance
user
- user to removestate
- state for which the user is interestedrole
- role name under which the user is interested
WorkflowException
public void addQuestion(Question question) throws WorkflowException
question
- the question to add
WorkflowException
public void computeValid()
computeValid
in interface UpdatableProcessInstance
public ProcessModel getProcessModel() throws WorkflowException
getProcessModel
in interface ProcessInstance
WorkflowException
public String create() throws WorkflowException
create
in interface ProcessInstance
WorkflowException
public void delete() throws WorkflowException
delete
in interface ProcessInstance
WorkflowException
public void update() throws WorkflowException
update
in interface ProcessInstance
WorkflowException
public HistoryStep[] getHistorySteps()
getHistorySteps
in interface ProcessInstance
public HistoryStep getHistoryStep(String stepId) throws WorkflowException
getHistoryStep
in interface ProcessInstance
WorkflowException
public Vector<Participant> getParticipants() throws WorkflowException
getParticipants
in interface ProcessInstance
WorkflowException
public Participant getParticipant(String resolvedState) throws WorkflowException
getParticipant
in interface ProcessInstance
resolvedState
- the resolved state
WorkflowException
public DataRecord getFolder() throws WorkflowException
getFolder
in interface ProcessInstance
WorkflowException
public DataRecord getAllDataRecord(String role, String lang) throws WorkflowException
getAllDataRecord
in interface ProcessInstance
WorkflowException
public DataRecord getRowDataRecord(String role, String lang) throws WorkflowException
getRowDataRecord
in interface ProcessInstance
WorkflowException
public Field getField(String fieldName) throws WorkflowException
getField
in interface ProcessInstance
WorkflowException
public void setField(String fieldName, Field copiedField) throws WorkflowException
setField
in interface UpdatableProcessInstance
fieldName
- copiedField
-
WorkflowException
public DataRecord getActionRecord(String actionName) throws WorkflowException
getActionRecord
in interface ProcessInstance
actionName
- action name
WorkflowException
public DataRecord getFormRecord(String formName, String role, String lang) throws WorkflowException
getFormRecord
in interface ProcessInstance
formName
- role
- lang
-
WorkflowException
public DataRecord getNewActionRecord(String actionName) throws WorkflowException
getNewActionRecord
in interface ProcessInstance
actionName
- action name
WorkflowException
public void saveActionRecord(HistoryStep step, DataRecord actionData) throws WorkflowException
saveActionRecord
in interface UpdatableProcessInstance
step
- actionData
-
WorkflowException
public HistoryStep getMostRecentStep(String actionName)
getMostRecentStep
in interface ProcessInstance
public HistoryStep getSavedStep(String userId) throws WorkflowException
getSavedStep
in interface ProcessInstance
WorkflowException
public HistoryStep getMostRecentStep(State state)
getMostRecentStep
in interface ProcessInstance
public String[] getActiveStates()
getActiveStates
in interface ProcessInstance
public boolean isStateInBackStatus(String stateName)
isStateInBackStatus
in interface ProcessInstance
stateName
- name of active state
public Actor[] getWorkingUsers() throws WorkflowException
ProcessInstance
getWorkingUsers
in interface ProcessInstance
WorkflowException
public Actor[] getWorkingUsers(String state) throws WorkflowException
ProcessInstance
getWorkingUsers
in interface ProcessInstance
state
-
WorkflowException
public void removeWorkingUsers(State state) throws WorkflowException
UpdatableProcessInstance
removeWorkingUsers
in interface UpdatableProcessInstance
state
- state for which the user is interested
WorkflowException
public void removeInterestedUsers(State state) throws WorkflowException
UpdatableProcessInstance
removeInterestedUsers
in interface UpdatableProcessInstance
state
- state for which the user is interested
WorkflowException
public Actor[] getWorkingUsers(String state, String role) throws WorkflowException
ProcessInstance
getWorkingUsers
in interface ProcessInstance
state
-
WorkflowException
public String[] getAssignedStates(User user, String roleName) throws WorkflowException
getAssignedStates
in interface ProcessInstance
WorkflowException
public LockingUser getLockingUser(String state) throws WorkflowException
getLockingUser
in interface ProcessInstance
state
-
WorkflowException
public void lock(State state, User user) throws WorkflowException
lock
in interface ProcessInstance
state
- state that have to be lockeduser
- the locking user
WorkflowException
public void unLock(State state, User user) throws WorkflowException
unLock
in interface ProcessInstance
state
- state that have to be un-lockeduser
- the current locking user
WorkflowException
public void lock() throws WorkflowException
lock
in interface UpdatableProcessInstance
WorkflowException
public void unLock() throws WorkflowException
unLock
in interface UpdatableProcessInstance
WorkflowException
public boolean isValid()
isValid
in interface ProcessInstance
public boolean isLockedByAdmin()
isLockedByAdmin
in interface ProcessInstance
public int isLockedByAdminCastor()
public void setLockedByAdmin(boolean locked)
locked
- true is this instance is locked by adminpublic void setLockedByAdminCastor(int locked)
public boolean getErrorStatus()
getErrorStatus
in interface ProcessInstance
public int getErrorStatusCastor()
public void setErrorStatus(boolean errorStatus)
setErrorStatus
in interface UpdatableProcessInstance
errorStatus
- true if this instance is in errorpublic void setErrorStatusCastor(int errorStatus)
public boolean getTimeoutStatus()
getTimeoutStatus
in interface ProcessInstance
public int getTimeoutStatusCastor()
public void setTimeoutStatus(boolean timeoutStatus)
setTimeoutStatus
in interface UpdatableProcessInstance
timeoutStatus
- true if this instance is in an active state for a long long timepublic void setTimeoutStatusCastor(int timeoutStatus)
public List<User> getUsersInRole(String role) throws WorkflowException
ProcessInstance
getUsersInRole
in interface ProcessInstance
role
- the name of the role
WorkflowException
public List<User> getUsersInGroup(String groupId) throws WorkflowException
ProcessInstance
getUsersInGroup
in interface ProcessInstance
groupId
- the id of the group
WorkflowException
public Actor[] getActors(QualifiedUsers qualifiedUsers, State state) throws WorkflowException
getActors
in interface ProcessInstance
qualifiedUsers
- Users defined by their role or by a relation with a participantstate
- State for which these user were/may be actors
WorkflowException
public void reDoState(String state, Date actionDate) throws WorkflowException
reDoState
in interface UpdatableProcessInstance
state
- the name of state where ac action has been discussedactionDate
- date of state re-resolving
WorkflowException
public HistoryStep[] getBackSteps(User user, String roleName, String stateName) throws WorkflowException
getBackSteps
in interface ProcessInstance
user
- user that can do the back actionsroleName
- role name of this userroleName
- role name of this userstateName
- name of state where user want to go back from
WorkflowException
public State addQuestion(String content, String stepId, State fromState, User fromUser) throws WorkflowException
addQuestion
in interface ProcessInstance
content
- question textstepId
- id of destination step for the questionfromState
- the state where the question was askedfromUser
- the user who asked the question
WorkflowException
public State answerQuestion(String content, String questionId) throws WorkflowException
answerQuestion
in interface ProcessInstance
content
- response textquestionId
- id of question corresponding to this response
WorkflowException
public Question[] getPendingQuestions(String stateName)
getPendingQuestions
in interface ProcessInstance
stateName
- given state name
public Question[] getSentQuestions(String stateName)
getSentQuestions
in interface ProcessInstance
stateName
- given state name
public Question[] getRelevantQuestions(String stateName)
getRelevantQuestions
in interface ProcessInstance
stateName
- given state name
public void cancelQuestion(Question question) throws WorkflowException
cancelQuestion
in interface UpdatableProcessInstance
question
- the question to cancel
WorkflowException
public Question[] getQuestions()
getQuestions
in interface ProcessInstance
public void castor_setHistorySteps(Vector historySteps)
historySteps
- history stepspublic Vector castor_getHistorySteps()
public void castor_setQuestions(Vector<Question> questions)
questions
- questionspublic Vector<Question> castor_getQuestions()
public void castor_setInterestedUsers(Vector<InterestedUser> interestedUsers)
interestedUsers
- users as a Vectorpublic Vector<InterestedUser> castor_getInterestedUsers()
public void castor_setWorkingUsers(Vector<WorkingUser> workingUsers)
workingUsers
- users as a Vectorpublic Vector<WorkingUser> castor_getWorkingUsers()
public void castor_setLockingUsers(Vector<LockingUser> lockingUsers)
lockingUsers
- users as a Vectorpublic Vector<LockingUser> castor_getLockingUsers()
public void castor_setActiveStates(Vector<ActiveState> activeStates)
activeStates
- states as a Vectorpublic Vector<ActiveState> castor_getActiveStates()
public String getTitle(String role, String lang)
getTitle
in interface ProcessInstance
role
- lang
-
public ActionAndState getTimeOutAction(Date dateRef) throws WorkflowException
getTimeOutAction
in interface ProcessInstance
WorkflowException
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |