Class ModelElementInstanceImpl
java.lang.Object
org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl
- All Implemented Interfaces:
ModelElementInstance
- Direct Known Subclasses:
BpmnModelElementInstanceImpl
,CmmnModelElementInstanceImpl
,DmnModelElementInstanceImpl
Base class for implementing Model Elements.
- Author:
- Daniel Meyer
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChildElement
(ModelElementInstance newChild) Adds a new child element to the children of this element.protected <T> Set<T>
boolean
getAttributeValue
(String attributeName) Returns the attribute value for the attribute name.getAttributeValueNs
(String namespaceUri, String attributeName) Returns the attribute value for the given attribute name and namespace URI.<T extends ModelElementInstance>
Collection<T>getChildElementsByType
(Class<T> childElementClass) Return all child elements of a given typegetChildElementsByType
(ModelElementType childElementType) Return all child elements of a given typeReturns the represented DOMDomElement
.Returns the element type of this.Returns the model instance which contains this type instance.Returns the parent element of this.Returns the raw text content of the DOM element including all whitespaces.Returns the text content of the DOM element without leading and trailing spaces.getUniqueChildElementByNameNs
(String namespaceUri, String elementName) Returns a child element with the given name or 'null' if no such element existsgetUniqueChildElementByType
(Class<? extends ModelElementInstance> elementType) Returns a child element with the given typeint
hashCode()
void
insertElementAfter
(ModelElementInstance elementToInsert, ModelElementInstance insertAfterElement) Inserts the new element after the given element or at the beginning if the given element is null.static void
registerType
(ModelBuilder modelBuilder) void
removeAttribute
(String attributeName) Removes attribute by name.void
removeAttributeNs
(String namespaceUri, String attributeName) Removes the attribute by name and namespace.boolean
Removes the child element from this.void
replaceChildElement
(ModelElementInstance existingChild, ModelElementInstance newChild) Replace an existing child element with a new child element.void
replaceWithElement
(ModelElementInstance newElement) Replaces this element with a new element and updates references.void
setAttributeValue
(String attributeName, String xmlValue) Sets the value by name of a non-ID attribute.void
setAttributeValue
(String attributeName, String xmlValue, boolean isIdAttribute) Sets attribute value by name.void
setAttributeValue
(String attributeName, String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate) Sets attribute value by name.void
setAttributeValueNs
(String namespaceUri, String attributeName, String xmlValue) Sets the value by name and namespace of a non-ID attribute.void
setAttributeValueNs
(String namespaceUri, String attributeName, String xmlValue, boolean isIdAttribute) Sets the attribute value by name and namespace.void
setAttributeValueNs
(String namespaceUri, String attributeName, String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate) Sets the attribute value by name and namespace.void
setTextContent
(String textContent) Sets the text content of the DOM elementvoid
Adds or replaces a child element by name.void
Execute updates after the element was inserted as a replacement of another element.
-
Field Details
-
modelInstance
the containing model instance
-
-
Constructor Details
-
ModelElementInstanceImpl
-
-
Method Details
-
registerType
-
getDomElement
Description copied from interface:ModelElementInstance
Returns the represented DOMDomElement
.- Specified by:
getDomElement
in interfaceModelElementInstance
- Returns:
- the DOM element
-
getModelInstance
Description copied from interface:ModelElementInstance
Returns the model instance which contains this type instance.- Specified by:
getModelInstance
in interfaceModelElementInstance
- Returns:
- the model instance
-
getParentElement
Description copied from interface:ModelElementInstance
Returns the parent element of this.- Specified by:
getParentElement
in interfaceModelElementInstance
- Returns:
- the parent element
-
getElementType
Description copied from interface:ModelElementInstance
Returns the element type of this.- Specified by:
getElementType
in interfaceModelElementInstance
- Returns:
- the element type
-
getAttributeValue
Description copied from interface:ModelElementInstance
Returns the attribute value for the attribute name.- Specified by:
getAttributeValue
in interfaceModelElementInstance
- Parameters:
attributeName
- the name of the attribute- Returns:
- the value of the attribute
-
getAttributeValueNs
Description copied from interface:ModelElementInstance
Returns the attribute value for the given attribute name and namespace URI.- Specified by:
getAttributeValueNs
in interfaceModelElementInstance
- Parameters:
namespaceUri
- the namespace URI of the attributeattributeName
- the attribute name of the attribute- Returns:
- the value of the attribute
-
setAttributeValue
Description copied from interface:ModelElementInstance
Sets the value by name of a non-ID attribute.- Specified by:
setAttributeValue
in interfaceModelElementInstance
- Parameters:
attributeName
- the name of the attributexmlValue
- the value to set
-
setAttributeValue
Description copied from interface:ModelElementInstance
Sets attribute value by name.- Specified by:
setAttributeValue
in interfaceModelElementInstance
- Parameters:
attributeName
- the name of the attributexmlValue
- the value to setisIdAttribute
- true if the attribute is an ID attribute, false otherwise
-
setAttributeValue
public void setAttributeValue(String attributeName, String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate) Description copied from interface:ModelElementInstance
Sets attribute value by name.- Specified by:
setAttributeValue
in interfaceModelElementInstance
- Parameters:
attributeName
- the name of the attributexmlValue
- the value to setisIdAttribute
- true if the attribute is an ID attribute, false otherwisewithReferenceUpdate
- true to update incoming references in other elements, false otherwise
-
setAttributeValueNs
Description copied from interface:ModelElementInstance
Sets the value by name and namespace of a non-ID attribute.- Specified by:
setAttributeValueNs
in interfaceModelElementInstance
- Parameters:
namespaceUri
- the namespace URI of the attributeattributeName
- the name of the attributexmlValue
- the XML value to set
-
setAttributeValueNs
public void setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue, boolean isIdAttribute) Description copied from interface:ModelElementInstance
Sets the attribute value by name and namespace.- Specified by:
setAttributeValueNs
in interfaceModelElementInstance
- Parameters:
namespaceUri
- the namespace URI of the attributeattributeName
- the name of the attributexmlValue
- the XML value to setisIdAttribute
- true if the attribute is an ID attribute, false otherwise
-
setAttributeValueNs
public void setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate) Description copied from interface:ModelElementInstance
Sets the attribute value by name and namespace.- Specified by:
setAttributeValueNs
in interfaceModelElementInstance
- Parameters:
namespaceUri
- the namespace URI of the attributeattributeName
- the name of the attributexmlValue
- the XML value to setisIdAttribute
- true if the attribute is an ID attribute, false otherwisewithReferenceUpdate
- true to update incoming references in other elements, false otherwise
-
removeAttribute
Description copied from interface:ModelElementInstance
Removes attribute by name.- Specified by:
removeAttribute
in interfaceModelElementInstance
- Parameters:
attributeName
- the name of the attribute
-
removeAttributeNs
Description copied from interface:ModelElementInstance
Removes the attribute by name and namespace.- Specified by:
removeAttributeNs
in interfaceModelElementInstance
- Parameters:
namespaceUri
- the namespace URI of the attributeattributeName
- the name of the attribute
-
getTextContent
Description copied from interface:ModelElementInstance
Returns the text content of the DOM element without leading and trailing spaces. For raw text content seegetRawTextContent()
.- Specified by:
getTextContent
in interfaceModelElementInstance
- Returns:
- text content of underlying DOM element with leading and trailing whitespace trimmed
-
setTextContent
Description copied from interface:ModelElementInstance
Sets the text content of the DOM element- Specified by:
setTextContent
in interfaceModelElementInstance
- Parameters:
textContent
- the new text content
-
getRawTextContent
Description copied from interface:ModelElementInstance
Returns the raw text content of the DOM element including all whitespaces.- Specified by:
getRawTextContent
in interfaceModelElementInstance
- Returns:
- raw text content of underlying DOM element
-
getUniqueChildElementByNameNs
Description copied from interface:ModelElementInstance
Returns a child element with the given name or 'null' if no such element exists- Specified by:
getUniqueChildElementByNameNs
in interfaceModelElementInstance
- Parameters:
namespaceUri
- the local name of the elementelementName
- the namespace of the element- Returns:
- the child element or null.
-
getUniqueChildElementByType
public ModelElementInstance getUniqueChildElementByType(Class<? extends ModelElementInstance> elementType) Description copied from interface:ModelElementInstance
Returns a child element with the given type- Specified by:
getUniqueChildElementByType
in interfaceModelElementInstance
- Parameters:
elementType
- the type of the element- Returns:
- the child element or null
-
setUniqueChildElementByNameNs
Description copied from interface:ModelElementInstance
Adds or replaces a child element by name. Replaces an existing Child Element with the same name or adds a new child if no such element exists.- Specified by:
setUniqueChildElementByNameNs
in interfaceModelElementInstance
- Parameters:
newChild
- the child to add
-
replaceChildElement
Description copied from interface:ModelElementInstance
Replace an existing child element with a new child element. Changes the underlying DOM element tree.- Specified by:
replaceChildElement
in interfaceModelElementInstance
- Parameters:
existingChild
- the child element to replacenewChild
- the new child element
-
replaceWithElement
Description copied from interface:ModelElementInstance
Replaces this element with a new element and updates references.- Specified by:
replaceWithElement
in interfaceModelElementInstance
- Parameters:
newElement
- the new element to replace with
-
addChildElement
Description copied from interface:ModelElementInstance
Adds a new child element to the children of this element. The child is inserted at the correct position of the allowed child types. Updates the underlying DOM element tree.- Specified by:
addChildElement
in interfaceModelElementInstance
- Parameters:
newChild
- the new child element
-
removeChildElement
Description copied from interface:ModelElementInstance
Removes the child element from this.- Specified by:
removeChildElement
in interfaceModelElementInstance
- Parameters:
child
- the child element to remove- Returns:
- true if the child element could be removed
-
getChildElementsByType
Description copied from interface:ModelElementInstance
Return all child elements of a given type- Specified by:
getChildElementsByType
in interfaceModelElementInstance
- Parameters:
childElementType
- the child element type to search for- Returns:
- a collection of elements of the given type
-
getChildElementsByType
public <T extends ModelElementInstance> Collection<T> getChildElementsByType(Class<T> childElementClass) Description copied from interface:ModelElementInstance
Return all child elements of a given type- Specified by:
getChildElementsByType
in interfaceModelElementInstance
- Parameters:
childElementClass
- the class of the child element type to search for- Returns:
- a collection of elements to the given type
-
insertElementAfter
public void insertElementAfter(ModelElementInstance elementToInsert, ModelElementInstance insertAfterElement) Description copied from interface:ModelElementInstance
Inserts the new element after the given element or at the beginning if the given element is null.- Specified by:
insertElementAfter
in interfaceModelElementInstance
- Parameters:
elementToInsert
- the new element to insertinsertAfterElement
- the element to insert after or null to insert at first position
-
updateAfterReplacement
public void updateAfterReplacement()Description copied from interface:ModelElementInstance
Execute updates after the element was inserted as a replacement of another element.- Specified by:
updateAfterReplacement
in interfaceModelElementInstance
-
asSet
-
hashCode
public int hashCode() -
equals
-