public class ProcessInstance extends Object implements XmlEntity, Collectible, ModelInstanceAware, EntityWithId, ProcessInstanceParent, ModelIdentifiable
Modifier | Constructor and Description |
---|---|
protected |
ProcessInstance()
Creates new empty instance of
ProcessInstance . |
|
ProcessInstance(long id,
ProcessInstanceParent parent,
Context context)
Creates new instance of
ProcessInstance . |
|
ProcessInstance(ProcessInstanceParent parent,
Context context)
Creates new instance of
ProcessInstance . |
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.
|
ProcessInstance |
findDescendant(long descendantId)
Finds a descendant process instance of this process instance.
|
Context |
getContext()
Returns the process instance context.
|
com.whitestein.lsps.model.ContextModelElement |
getElement(ModelProviderClientService modelProviderService)
Returns the model element.
|
String |
getElementId()
Returns the model id.
|
String |
getElementId(ModelProviderClientService modelProviderService)
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(ModelProviderClientService modelProviderService)
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.
|
ProcessInstance |
makeCopy(ModelInstance targetModelInstance,
ProcessInstanceParent targetParent)
Returns deep copy.
|
void |
postUnmarshal(javax.xml.bind.Unmarshaller unmarshaller,
Object parent)
Callback method invoked after unmarshalling XML data into target.
|
void |
preUnmarshal(javax.xml.bind.Unmarshaller unmarshaller,
Object parent)
Callback method invoked before unmarshalling into target.
|
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.
|
String |
toString() |
protected ProcessInstance()
ProcessInstance
.public ProcessInstance(ProcessInstanceParent parent, Context context)
ProcessInstance
.parent
- context
- NullPointerException
- if moduleInstance
or context
is nullpublic ProcessInstance(long id, ProcessInstanceParent parent, Context context)
ProcessInstance
.id
- parent
- context
- NullPointerException
- if moduleInstance
or context
is nullpublic 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(ModelProviderClientService modelProviderService)
ModelIdentifiable
getElementId
in interface ModelIdentifiable
public com.whitestein.lsps.model.ContextModelElement getElement(ModelProviderClientService modelProviderService)
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 void preUnmarshal(javax.xml.bind.Unmarshaller unmarshaller, Object parent)
UnmarshalCallback
preUnmarshal
in interface UnmarshalCallback
parent
- instance of JAXB mapped class that will eventually reference target.
null when target is root element.public void postUnmarshal(javax.xml.bind.Unmarshaller unmarshaller, Object parent)
UnmarshalCallback
postUnmarshal
in interface UnmarshalCallback
parent
- instance of JAXB mapped class that will reference target.
null when target is root element.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(ModelProviderClientService modelProviderService)
modelProviderService
- 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 makeCopy(ModelInstance targetModelInstance, ProcessInstanceParent targetParent)
targetModelInstance
- targetParent
- public ProcessInstance getTopOfInlinedProcess()
public boolean isInlined()
public void setIsInlined(boolean isInlined)
isInlined
- public void setTerminatedByNoExit(boolean value)
value
- public boolean isTerminatedByNoExit()
Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.