public class Context extends Object implements Collectible, ModelInstanceAware, EntityWithId, ModelIdentifiable, EvaluationLevelAware
Value
.Modifier | Constructor and Description |
---|---|
protected |
Context(Context context,
ModelInstance targetModelInstance) |
|
Context(long id,
ModelInstance modelInstance,
Context parentContext,
com.whitestein.lsps.model.ContextModelElement element)
Creates new instance of
Context for given ProcessModel . |
|
Context(long id,
ModelInstance modelInstance,
Context parentContext,
String name)
Creates new instance of
Context . |
|
Context(long id,
ModelInstance modelInstance,
Context parentContext,
String name,
String level,
long baseLevelContextId,
Context lowerLevelContext)
Creates new instance of
Context . |
|
Context(ModelInstance modelInstance,
Context parentContext,
com.whitestein.lsps.model.ContextModelElement element)
Creates new instance of
Context for given ProcessModel . |
|
Context(ModelInstance modelInstance,
Context parentContext,
String name)
Creates new instance of
Context . |
|
Context(ModelInstance modelInstance,
Context parentContext,
String name,
String level,
long baseLevelContextId,
Context lowerLevelContext)
Creates new instance of
Context . |
protected |
Context(SContext source,
Context parentContext,
ModelInstance modelInstance)
Creates a new instance from the serialized companion.
|
Modifier and Type | Method and Description |
---|---|
Context |
addChildContext(Context context)
Adds context as child of this context.
|
Context |
addNewChildContext(com.whitestein.lsps.model.ContextModelElement element)
Adds new child context.
|
Context |
addNewChildContext(String name)
Adds new child context.
|
Context |
addNewChildContext(String name,
Map<FreeType,Type> freeTypeMapping)
Adds new child context.
|
Variable |
addNewVariable(String name,
String type)
Deprecated.
|
Variable |
addNewVariable(String name,
String type,
Type compiledType,
Value value,
boolean isReadOnly)
Adds a new variable.
|
Variable |
addNewVariable(String name,
String type,
Value value,
boolean isReadOnly)
Deprecated.
|
Variable |
addNewVariable(String name,
Type type)
Adds a new variable.
|
Variable |
addNewVariable(String name,
Type type,
Value value,
boolean isReadOnly)
Adds a new variable.
|
Variable |
addVariable(Variable var)
Adds new variable.
|
void |
addVariables(Collection<? extends Variable> variables)
Adds several variables.
|
void |
clear()
Clears variables.
|
protected NamespaceModel |
clearNamespaceModel() |
void |
collect()
Removes itself from the process.
|
void |
collectTree()
Collects this context and all its children (recursivelly).
|
boolean |
containsVariable(String name)
Returns true if this context contains variable with given name.
|
protected void |
convertToDirectReferences() |
void |
convertToRemovedRecordContext(ModelProvider modelProvider)
Do not use this method!
This method is used only in evaluation levels merge.
|
Context |
createCopy(ModelInstance targetModelInstance)
Creates a copy without references to other objects.
|
Context |
createInLevel(String level,
Context parentContext,
CommonRecordValue record,
Context lowerLevelContext)
Creates a context on a given level.
|
protected NamespaceModel |
createNamespaceModel(ModelProvider modelProvider)
Creates namespace model for this.
|
Variable |
createVariable(String name,
String type,
Type compiledType,
Value value,
boolean isReadOnly)
Creates a variable but does not add it to the context yet.
|
void |
finishCopy(com.whitestein.lsps.engine.state.xml.Copiable source,
CopyHelper helper)
Copy references.
|
static Context |
fromSerializable(SContext source,
Context parentContext,
ModelInstance modelInstance)
Creates a new instance from the serialized companion.
|
Set<String> |
getAllFreeTypeNames()
Returns all free type names.
|
Context |
getBaseLevelEntity()
Returns base level context.
|
long |
getBaseLevelEntityId()
Returns id of the corresponding context in base level.
|
Collection<Context> |
getChildContexts()
Returns immutable collection of child contexts.
|
CompiledNamespace |
getCompiled()
Returns instance of namespace compiled to java.
|
Type |
getCompiledType(ModelProvider modelProvider,
String typeName)
Returns the compiled type.
|
com.whitestein.lsps.model.ContextModelElement |
getElement(ModelProvider modelProvider)
Returns the model element.
|
String |
getElementId()
Returns the element id.
|
String |
getElementId(ModelProvider modelProvider)
Returns the model element id.
|
String |
getEvaluationLevel()
Returns evaluation level of this value.
|
ContextFreeType |
getFreeType(String name)
Returns free type value for given name or null if it does not exist.
|
FreeTypeMapping |
getFreeTypeMapping(ModelProvider modelProvider)
Returns free type mappings for this context.
|
long |
getId()
Returns the id.
|
Context |
getLowerLevelEntity()
Returns lower level context.
|
Long |
getLowerLevelEntityId()
Returns id of the corresponding context in previous lower level.
|
Context |
getLowestLevelEntity()
Returns lowest level context.
|
ModelInstance |
getModelInstance()
Returns the model instance.
|
String |
getName()
Returns name of this context.
|
NamespaceModel |
getNamespaceModel(ModelProvider modelProvider)
Returns namespace model
|
Context |
getParentContext()
Returns the parent context or null if this is top module context.
|
String |
getPath()
Returns the full path to this element as a string.
|
QID |
getPathQID()
Returns the full path to this element as a QID.
|
ProcessInstance |
getProcessInstance()
Returns the process instance containing this context, can be null.
|
CommonRecordValue |
getRecordValue()
Returns record value.
|
Long |
getRecordValueId()
Returns id of record value.
|
Collection<Collectible> |
getReferences()
Returns collection of all referenced collectible objects.
|
Context |
getTopContext()
Returns the top module context.
|
Variable |
getVariableInstance(String name)
Returns variable instance by variable name or null if it does not exist.
|
Set<String> |
getVariableNames()
Returns the names of the variables.
|
Collection<Variable> |
getVariables()
Returns an immutable collection of variables.
|
Value |
getVariableValue(String name)
Returns variable value for given name or null if it does not exist.
|
boolean |
hasParent(Context ctx)
Returns true if any of the parents (not only direct one) is the specified context.
|
boolean |
isPersistent()
Returns true if this object cannot be collected.
|
Context |
makeCopy(ModelInstance targetModelInstance)
Returns deep copy.
|
void |
rebind(ModelInstance modelInstance)
Re-binds to a model instance.
|
void |
refreshDirectReferences()
Re-set references to elements from the same model instance.
|
boolean |
removeChildContext(Context context)
Removes a child context.
|
void |
replaceReferencedIds(Map<Long,Long> replacementMap)
Replace referenced ids according to mappings in the replacement map.
|
void |
setCompiled(CompiledNamespace compiled)
Sets instance of namespace compiled to java
|
void |
setLowerLevelEntity(Context lowerLevelEntity)
Sets lower level entity.
|
void |
setVariables(Collection<? extends Variable> variables)
Sets variables.
|
void |
setVariableValue(String name,
Value value)
Sets variable value for given name.
|
SContext |
toSerializable(SContext parent,
SModelInstance smi,
MarshallerConfig config)
Creates a serializable object.
|
String |
toString() |
public Context(long id, ModelInstance modelInstance, Context parentContext, String name, String level, long baseLevelContextId, Context lowerLevelContext)
Context
.id
- modelInstance
- parentContext
- name
- level
- baseLevelContextId
- lowerLevelContext
- NullPointerException
- if moduleInstance
or name
public Context(ModelInstance modelInstance, Context parentContext, String name, String level, long baseLevelContextId, Context lowerLevelContext)
Context
.modelInstance
- parentContext
- name
- level
- baseLevelContextId
- lowerLevelContext
- NullPointerException
- if moduleInstance
or name
public Context(long id, ModelInstance modelInstance, Context parentContext, String name)
Context
.id
- modelInstance
- parentContext
- name
- NullPointerException
- if moduleInstance
or name
public Context(ModelInstance modelInstance, Context parentContext, String name)
Context
.modelInstance
- parentContext
- name
- NullPointerException
- if moduleInstance
or name
public Context(ModelInstance modelInstance, Context parentContext, com.whitestein.lsps.model.ContextModelElement element)
Context
for given ProcessModel
.
It creates the context as a top context.modelInstance
- parentContext
- element
- NullPointerException
- if modelInstance
or moduleInstance
or
element
is nullpublic Context(long id, ModelInstance modelInstance, Context parentContext, com.whitestein.lsps.model.ContextModelElement element)
Context
for given ProcessModel
.
It creates the context as a top context.id
- modelInstance
- parentContext
- element
- NullPointerException
- if modelInstance
or moduleInstance
or
element
is nullprotected Context(SContext source, Context parentContext, ModelInstance modelInstance)
source
- parentContext
- modelInstance
- protected Context(Context context, ModelInstance targetModelInstance)
public static Context fromSerializable(SContext source, Context parentContext, ModelInstance modelInstance)
source
- parentContext
- modelInstance
- public SContext toSerializable(SContext parent, SModelInstance smi, MarshallerConfig config)
parent
- smi
- config
- public long getId()
EntityWithId
getId
in interface EntityWithId
public String getName()
public Long getRecordValueId()
public CommonRecordValue getRecordValue()
public QID getPathQID()
public String getPath()
public Context getParentContext()
public Context getTopContext()
public boolean hasParent(Context ctx)
ctx
- public Collection<Context> getChildContexts()
public Context addChildContext(Context context)
context
- public boolean removeChildContext(Context context)
context
- public Context addNewChildContext(com.whitestein.lsps.model.ContextModelElement element)
element
- NullPointerException
- if element
is nullpublic Context addNewChildContext(String name)
name
- NullPointerException
- if name
is nullpublic Context addNewChildContext(String name, Map<FreeType,Type> freeTypeMapping)
name
- freeTypeMapping
- NullPointerException
- if name
is nullpublic boolean containsVariable(String name)
name
- variable namepublic Collection<Variable> getVariables()
public Set<String> getVariableNames()
public Variable getVariableInstance(String name)
name
- public Value getVariableValue(String name)
name
- public void setVariableValue(String name, Value value)
name
- value
- IllegalArgumentException
- if given variable does not existNullPointerException
- if value
is nullpublic 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 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 void collectTree()
public Variable addVariable(Variable var)
var
- IllegalArgumentException
- if a variable with the same name already existpublic void addVariables(Collection<? extends Variable> variables)
variables
- public void setVariables(Collection<? extends Variable> variables)
variables
- protected NamespaceModel clearNamespaceModel()
@Deprecated public Variable addNewVariable(String name, String type)
addNewVariable(String, Type)
name
- type
- IllegalArgumentException
- if a variable with the same name already existpublic Variable addNewVariable(String name, Type type)
name
- type
- IllegalArgumentException
- if a variable with the same name already exist@Deprecated public Variable addNewVariable(String name, String type, Value value, boolean isReadOnly)
addNewVariable(String, Type, Value, boolean)
name
- type
- value
- isReadOnly
- IllegalArgumentException
- if a variable with the same name already existpublic Variable addNewVariable(String name, Type type, Value value, boolean isReadOnly)
name
- type
- value
- isReadOnly
- IllegalArgumentException
- if a variable with the same name already existpublic Variable addNewVariable(String name, String type, Type compiledType, Value value, boolean isReadOnly)
name
- type
- compiledType
- a compiled type if known, may be null
value
- isReadOnly
- IllegalArgumentException
- if a variable with the same name already existpublic Variable createVariable(String name, String type, Type compiledType, Value value, boolean isReadOnly)
name
- type
- compiledType
- value
- isReadOnly
- public ContextFreeType getFreeType(String name)
name
- NullPointerException
- if name
is nullpublic ProcessInstance getProcessInstance()
public ModelInstance getModelInstance()
ModelInstanceAware
getModelInstance
in interface ModelInstanceAware
public String getEvaluationLevel()
getEvaluationLevel
in interface EvaluationLevelAware
public long getBaseLevelEntityId()
getBaseLevelEntityId
in interface EvaluationLevelAware
public Context getBaseLevelEntity()
getBaseLevelEntity
in interface EvaluationLevelAware
public Context getLowestLevelEntity()
public Long getLowerLevelEntityId()
getLowerLevelEntityId
in interface EvaluationLevelAware
public Context getLowerLevelEntity()
getLowerLevelEntity
in interface EvaluationLevelAware
public void setLowerLevelEntity(Context lowerLevelEntity)
lowerLevelEntity
- public NamespaceModel getNamespaceModel(ModelProvider modelProvider)
modelProvider
- protected NamespaceModel createNamespaceModel(ModelProvider modelProvider)
modelProvider
- public FreeTypeMapping getFreeTypeMapping(ModelProvider modelProvider)
modelProvider
- public Set<String> getAllFreeTypeNames()
public Type getCompiledType(ModelProvider modelProvider, String typeName)
modelProvider
- typeName
- public void replaceReferencedIds(Map<Long,Long> replacementMap)
replaceReferencedIds
in interface EvaluationLevelAware
replacementMap
- public void rebind(ModelInstance modelInstance)
rebind
in interface ModelInstanceAware
modelInstance
- public void clear()
clear
in interface EvaluationLevelAware
public Context createCopy(ModelInstance targetModelInstance)
public void finishCopy(com.whitestein.lsps.engine.state.xml.Copiable source, CopyHelper helper)
public final Context makeCopy(ModelInstance targetModelInstance)
targetModelInstance
- public CompiledNamespace getCompiled()
public void setCompiled(CompiledNamespace compiled)
compiled
- protected void convertToDirectReferences()
public void refreshDirectReferences()
EvaluationLevelAware
refreshDirectReferences
in interface EvaluationLevelAware
public Context createInLevel(String level, Context parentContext, CommonRecordValue record, Context lowerLevelContext)
level
- parentContext
- record
- lowerLevelContext
- public void convertToRemovedRecordContext(ModelProvider modelProvider)
modelProvider
- Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.