public class ProcessInstance extends Object implements Collectible, ModelInstanceAware, EntityWithId, ProcessInstanceParent, ModelIdentifiable
Constructor and Description |
---|
ProcessInstance(ProcessInstanceParent parent,
Context context)
Creates new instance of
ProcessInstance . |
ProcessInstance(SProcessInstance source,
ProcessInstance parent,
ModuleInstance moduleInstance,
ModelInstance modelInstance)
Creates a new instance from the serialized companion.
|
Modifier and Type | Method and Description |
---|---|
void |
addCommand(ActivationCommand cmd)
Adds an activation command.
|
ProcessInstance |
addNewProcessInstance(Context context)
Adds new child process instance.
|
ProcessInstance |
addNewProcessInstance(com.whitestein.lsps.model.ContextModelElement element)
Adds new child process instance.
|
Token |
addNewToken()
Adds a new token.
|
Token |
addNewToken(String modelId)
Adds a new token.
|
ProcessInstance |
addProcessInstance(ProcessInstance processInstance)
Adds a process instances as a child of this process instance.
|
Token |
addToken(Token token)
Adds a token.
|
void |
collect()
Removes itself from the process.
|
boolean |
containsToken(Token token)
Returns true if this context contains given token.
|
protected void |
convertToDirectReferences() |
ProcessInstance |
createCopy(ModelInstance targetModelInstance)
Creates a copy without references to other objects.
|
ProcessInstance |
findDescendant(long descendantId)
Finds a descendant process instance of this process instance.
|
void |
finishCopy(com.whitestein.lsps.engine.state.xml.Copiable source,
CopyHelper helper)
Copy references.
|
Context |
getContext()
Returns the process instance context.
|
com.whitestein.lsps.model.ContextModelElement |
getElement(ModelProvider modelProvider)
Returns the model element.
|
String |
getElementId()
Returns the model id.
|
String |
getElementId(ModelProvider modelProvider)
Returns the model element id.
|
Collection<Goal> |
getGoals()
Returns the collection of top goals.
|
GOElement |
getGOElement(String name)
Returns the go element by its name.
|
Collection<GOElement> |
getGOElements()
Returns all go elements.
|
long |
getId()
Returns the id.
|
String |
getIteratorValue() |
ModelInstance |
getModelInstance()
Returns the model instance.
|
ModuleInstance |
getModuleInstance()
Returns the module.
|
String |
getName()
Returns the context name.
|
ProcessInstance |
getParent()
Returns the parent process instance or null if this is a top process
instance.
|
com.whitestein.lsps.model.FlowElement |
getParentModelElement(ModelProvider modelProvider)
Returns parent model element if exists.
|
String |
getParentModelElementId()
Gets the identifier of a model element the execution of which produced
this process instance.
|
String |
getPath()
Returns the full path to this element as a string.
|
QID |
getPathQID()
Returns the full path to this element as a QID.
|
Collection<ProcessInstance> |
getProcessInstances()
Returns immutable collection of child process instances.
|
Collection<Collectible> |
getReferences()
Returns collection of all referenced collectible objects.
|
ProcessInstanceState |
getState()
Returns the state.
|
Collection<Token> |
getTokens()
Returns the tokens.
|
ProcessInstance |
getTopOfInlinedProcess()
Returns first parent that is not in-lined.
|
void |
interrupt(TerminationReason terminationReason)
Interrupts this process instance - i.e.
|
boolean |
isCommandsEmpty()
Returns true if the command queue is empty.
|
boolean |
isFinished()
Returns true if the state is
ProcessInstanceState.FINISHED . |
boolean |
isInlined()
Returns true if the process is in-lined or some of its parent is in-lined.
|
boolean |
isNew()
Returns true if the state is
ProcessInstanceState.CREATED . |
boolean |
isPersistent()
Returns true if this object cannot be collected.
|
boolean |
isRunning()
Returns true if the state is
ProcessInstanceState.RUNNING . |
boolean |
isSuspended()
Returns true if the state is
ProcessInstanceState.SUSPENDED . |
boolean |
isTerminatedByNoExit()
Returns true if process was terminated by no exit event.
|
void |
rebind(ModelInstance modelInstance)
Re-bind to the provided model instance.
|
void |
removeAllTokens()
Removes all tokens.
|
ActivationCommand |
removeFirstCommand()
Removes and returns the first command.
|
boolean |
removeProcessInstance(ProcessInstance processInstance)
Removes a process instance.
|
void |
removeToken(Token token,
boolean isInterrupted)
Removes a token.
|
void |
setIsInlined(boolean isInlined)
Sets property isIlined.
|
void |
setIteratorValue(String iteratorValue) |
void |
setParentModelElementId(String parentModelElementId)
Sets the identifier of a model element the execution of which produced
this process instance.
|
void |
setState(ProcessInstanceState state)
Sets the state.
|
void |
setTerminatedByNoExit(boolean value)
Sets value whether process was terminated by no exit event
|
void |
startGoal(Goal goal)
Starts the goal execution.
|
SProcessInstance |
toSerializable(SProcessInstance parent,
SModuleInstance module,
SModelInstance smi,
MarshallerConfig config)
Creates a serializable object.
|
String |
toString() |
public ProcessInstance(ProcessInstanceParent parent, Context context)
ProcessInstance
.parent
- context
- NullPointerException
- if moduleInstance
or context
is nullpublic ProcessInstance(SProcessInstance source, ProcessInstance parent, ModuleInstance moduleInstance, ModelInstance modelInstance)
source
- parent
- moduleInstance
- modelInstance
- public SProcessInstance toSerializable(SProcessInstance parent, SModuleInstance module, SModelInstance smi, MarshallerConfig config)
parent
- module
- smi
- config
- public ProcessInstanceState getState()
public void setState(ProcessInstanceState state)
state
- NullPointerException
- if state
is nullpublic void interrupt(TerminationReason terminationReason)
terminationReason
- public boolean isFinished()
ProcessInstanceState.FINISHED
.ProcessInstanceState.FINISHED
public boolean isRunning()
ProcessInstanceState.RUNNING
.ProcessInstanceState.RUNNING
public boolean isSuspended()
ProcessInstanceState.SUSPENDED
.ProcessInstanceState.SUSPENDED
public boolean isNew()
ProcessInstanceState.CREATED
.ProcessInstanceState.CREATED
public long getId()
EntityWithId
getId
in interface EntityWithId
public String getName()
public String getElementId()
public String getElementId(ModelProvider modelProvider)
ModelIdentifiable
getElementId
in interface ModelIdentifiable
public com.whitestein.lsps.model.ContextModelElement getElement(ModelProvider modelProvider)
ModelIdentifiable
getElement
in interface ModelIdentifiable
public Context getContext()
getContext
in interface ProcessInstanceParent
public ProcessInstance getParent()
public Collection<ProcessInstance> getProcessInstances()
public ProcessInstance addProcessInstance(ProcessInstance processInstance)
addProcessInstance
in interface ProcessInstanceParent
processInstance
- public boolean removeProcessInstance(ProcessInstance processInstance)
removeProcessInstance
in interface ProcessInstanceParent
processInstance
- public ProcessInstance addNewProcessInstance(com.whitestein.lsps.model.ContextModelElement element)
addNewProcessInstance
in interface ProcessInstanceParent
element
- NullPointerException
- if element
is nullpublic ProcessInstance addNewProcessInstance(Context context)
addNewProcessInstance
in interface ProcessInstanceParent
context
- NullPointerException
- if context
is nullpublic Collection<Token> getTokens()
public Token addToken(Token token)
token
- NullPointerException
- if token
is nullpublic Token addNewToken()
public Token addNewToken(String modelId)
modelId
- public void removeToken(Token token, boolean isInterrupted)
token
- isInterrupted
- public void removeAllTokens()
public boolean containsToken(Token token)
token
- public void startGoal(Goal goal)
goal
- public Collection<Goal> getGoals()
public void addCommand(ActivationCommand cmd)
cmd
- public boolean isCommandsEmpty()
public ActivationCommand removeFirstCommand()
public GOElement getGOElement(String name)
name
- public Collection<GOElement> getGOElements()
public boolean isPersistent()
Collectible
isPersistent
in interface Collectible
public Collection<Collectible> getReferences()
Collectible
getReferences
in interface Collectible
public void collect()
Collectible
collect
in interface Collectible
public ModelInstance getModelInstance()
ModelInstanceAware
getModelInstance
in interface ModelInstanceAware
public void rebind(ModelInstance modelInstance)
ModelInstanceAware
rebind
in interface ModelInstanceAware
public ModuleInstance getModuleInstance()
getModuleInstance
in interface ProcessInstanceParent
public QID getPathQID()
ProcessInstanceParent
getPathQID
in interface ProcessInstanceParent
public String getPath()
ProcessInstanceParent
getPath
in interface ProcessInstanceParent
public String getParentModelElementId()
Gets the identifier of a model element the execution of which produced this process instance.
Model element which produce a new process instance when executed are:
public com.whitestein.lsps.model.FlowElement getParentModelElement(ModelProvider modelProvider)
modelProvider
- public void setParentModelElementId(String parentModelElementId)
parentModelElementId
- the model element identifiergetParentModelElementId()
public String getIteratorValue()
public void setIteratorValue(String iteratorValue)
iteratorValue
- the iteratorValue to setpublic ProcessInstance findDescendant(long descendantId)
null
is returned.descendantId
- the identifier of the descendant process instancenull
if there is no
descendant process instance with the given identifier.public ProcessInstance createCopy(ModelInstance targetModelInstance)
public void finishCopy(com.whitestein.lsps.engine.state.xml.Copiable source, CopyHelper helper)
public ProcessInstance getTopOfInlinedProcess()
public boolean isInlined()
public void setIsInlined(boolean isInlined)
isInlined
- public void setTerminatedByNoExit(boolean value)
value
- public boolean isTerminatedByNoExit()
protected void convertToDirectReferences()
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.