Package org.camunda.bpm.model.xml.impl
Class ModelInstanceImpl
java.lang.Object
org.camunda.bpm.model.xml.impl.ModelInstanceImpl
- All Implemented Interfaces:
ModelInstance
- Direct Known Subclasses:
BpmnModelInstanceImpl,CmmnModelInstanceImpl,DmnModelInstanceImpl
An instance of a model
- Author:
- Daniel Meyer, Sebastian Menski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DomDocumentprotected ModelImplprotected final ModelBuilder -
Constructor Summary
ConstructorsConstructorDescriptionModelInstanceImpl(ModelImpl model, ModelBuilder modelBuilder, DomDocument document) -
Method Summary
Modifier and TypeMethodDescriptionclone()Copies the model instance but not the model.Returns the wrappedDomDocument.Returns theModelElementcorresponding to the document element of this model or null if no document element exists.getModel()Returns the underlying model.<T extends ModelElementInstance>
TFind a unique element of the model by id.<T extends ModelElementInstance>
Collection<T>getModelElementsByType(Class<T> referencingClass) Find all elements of a type.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.registerGenericType(String namespaceUri, String localName) voidsetDocumentElement(ModelElementInstance modelElement) Updates the document element.validate(Collection<ModelElementValidator<?>> validators) Validate semantic properties of this model instance using a collection of validators.
-
Field Details
-
document
-
model
-
modelBuilder
-
-
Constructor Details
-
ModelInstanceImpl
-
-
Method Details
-
getDocument
Description copied from interface:ModelInstanceReturns the wrappedDomDocument.- Specified by:
getDocumentin interfaceModelInstance- Returns:
- the DOM document
-
getDocumentElement
Description copied from interface:ModelInstanceReturns theModelElementcorresponding to the document element of this model or null if no document element exists.- Specified by:
getDocumentElementin interfaceModelInstance- Returns:
- the document element or null
-
setDocumentElement
Description copied from interface:ModelInstanceUpdates the document element.- Specified by:
setDocumentElementin interfaceModelInstance- Parameters:
modelElement- the new document element to set
-
newInstance
Description copied from interface:ModelInstanceCreates a new instance of type class.- Specified by:
newInstancein interfaceModelInstance- Type Parameters:
T- instance type- Parameters:
type- the class of the type to create- Returns:
- the new created instance
-
newInstance
Description copied from interface:ModelInstanceCreates a new instance of type class with user-defined id.- Specified by:
newInstancein interfaceModelInstance- 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
Description copied from interface:ModelInstanceCreates a new instance of type.- Specified by:
newInstancein interfaceModelInstance- Type Parameters:
T- instance type- Parameters:
type- the type to create- Returns:
- the new created instance
-
newInstance
Description copied from interface:ModelInstanceCreates a new instance of type with user-defined id.- Specified by:
newInstancein interfaceModelInstance- Type Parameters:
T- instance type- Parameters:
type- the type to createid- identifier of new element instance- Returns:
- the new created instance
-
getModel
Description copied from interface:ModelInstanceReturns the underlying model.- Specified by:
getModelin interfaceModelInstance- Returns:
- the model
-
registerGenericType
-
getModelElementById
Description copied from interface:ModelInstanceFind a unique element of the model by id.- Specified by:
getModelElementByIdin interfaceModelInstance- Parameters:
id- the id of the element- Returns:
- the element with the id or null
-
getModelElementsByType
Description copied from interface:ModelInstanceFind all elements of a type.- Specified by:
getModelElementsByTypein interfaceModelInstance- Parameters:
type- the type of the elements- Returns:
- the collection of elements of the type
-
getModelElementsByType
public <T extends ModelElementInstance> Collection<T> getModelElementsByType(Class<T> referencingClass) Description copied from interface:ModelInstanceFind all elements of a type.- Specified by:
getModelElementsByTypein interfaceModelInstance- Parameters:
referencingClass- the type class of the elements- Returns:
- the collection of elements of the type
-
clone
Description copied from interface:ModelInstanceCopies 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.- Specified by:
clonein interfaceModelInstance- Overrides:
clonein classObject- Returns:
- the new model instance
-
validate
Description copied from interface:ModelInstanceValidate 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 aValidationResultsobject which is returned by this method.- Specified by:
validatein interfaceModelInstance- Parameters:
validators- the validators to execute- Returns:
- the results of the validation.
-