Package org.camunda.bpm.model.xml
Interface ModelInstance
-
- All Known Subinterfaces:
BpmnModelInstance
,CmmnModelInstance
,DmnModelInstance
- All Known Implementing Classes:
BpmnModelInstanceImpl
,CmmnModelInstanceImpl
,DmnModelInstanceImpl
,ModelInstanceImpl
public interface ModelInstance
An instance of a model- Author:
- Daniel Meyer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ModelInstance
clone()
Copies the model instance but not the model.DomDocument
getDocument()
Returns the wrappedDomDocument
.ModelElementInstance
getDocumentElement()
Returns theModelElement
corresponding to the document element of this model or null if no document element exists.Model
getModel()
Returns the underlying model.<T extends ModelElementInstance>
TgetModelElementById(String id)
Find a unique element of the model by id.<T extends ModelElementInstance>
Collection<T>getModelElementsByType(Class<T> referencingClass)
Find all elements of a type.Collection<ModelElementInstance>
getModelElementsByType(ModelElementType referencingType)
Find all elements of a type.<T extends ModelElementInstance>
TnewInstance(Class<T> type)
Creates a new instance of type class.<T extends ModelElementInstance>
TnewInstance(Class<T> type, String id)
Creates a new instance of type class with user-defined id.<T extends ModelElementInstance>
TnewInstance(ModelElementType type)
Creates a new instance of type.<T extends ModelElementInstance>
TnewInstance(ModelElementType type, String id)
Creates a new instance of type with user-defined id.void
setDocumentElement(ModelElementInstance documentElement)
Updates the document element.ValidationResults
validate(Collection<ModelElementValidator<?>> validators)
Validate semantic properties of this model instance using a collection of validators.
-
-
-
Method Detail
-
getDocument
DomDocument getDocument()
Returns the wrappedDomDocument
.- Returns:
- the DOM document
-
getDocumentElement
ModelElementInstance getDocumentElement()
Returns theModelElement
corresponding to the document element of this model or null if no document element exists.- Returns:
- the document element or null
-
setDocumentElement
void setDocumentElement(ModelElementInstance documentElement)
Updates the document element.- Parameters:
documentElement
- the new document element to set
-
newInstance
<T extends ModelElementInstance> T newInstance(Class<T> type)
Creates a new instance of type class.- Type Parameters:
T
- instance type- Parameters:
type
- the class of the type to create- Returns:
- the new created instance
-
newInstance
<T extends ModelElementInstance> T newInstance(Class<T> type, String id)
Creates a new instance of type class with user-defined id.- Type Parameters:
T
- instance type- Parameters:
type
- the class of the type to createid
- identifier of new element instance- Returns:
- the new created instance
-
newInstance
<T extends ModelElementInstance> T newInstance(ModelElementType type)
Creates a new instance of type.- Type Parameters:
T
- instance type- Parameters:
type
- the type to create- Returns:
- the new created instance
-
newInstance
<T extends ModelElementInstance> T newInstance(ModelElementType type, String id)
Creates a new instance of type with user-defined id.- Type Parameters:
T
- instance type- Parameters:
type
- the type to createid
- identifier of new element instance- Returns:
- the new created instance
-
getModel
Model getModel()
Returns the underlying model.- Returns:
- the model
-
getModelElementById
<T extends ModelElementInstance> T getModelElementById(String id)
Find a unique element of the model by id.- Parameters:
id
- the id of the element- Returns:
- the element with the id or null
-
getModelElementsByType
Collection<ModelElementInstance> getModelElementsByType(ModelElementType referencingType)
Find all elements of a type.- Parameters:
referencingType
- the type of the elements- Returns:
- the collection of elements of the type
-
getModelElementsByType
<T extends ModelElementInstance> Collection<T> getModelElementsByType(Class<T> referencingClass)
Find all elements of a type.- Parameters:
referencingClass
- the type class of the elements- Returns:
- the collection of elements of the type
-
clone
ModelInstance clone()
Copies the model instance but not the model. So only the wrapped DOM document is cloned. Changes of the model are persistent between multiple model instances.- Returns:
- the new model instance
-
validate
ValidationResults validate(Collection<ModelElementValidator<?>> validators)
Validate semantic properties of this model instance using a collection of validators. ModelElementValidator is an SPI that can be implemented by the user to execute custom validation logic on the model. The validation results are collected into aValidationResults
object which is returned by this method.- Parameters:
validators
- the validators to execute- Returns:
- the results of the validation.
- Since:
- 7.6
-
-