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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChildElement(ModelElementInstance newChild) Adds a new child element to the children of this element.protected <T> Set<T>booleangetAttributeValue(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 typeinthashCode()voidinsertElementAfter(ModelElementInstance elementToInsert, ModelElementInstance insertAfterElement) Inserts the new element after the given element or at the beginning if the given element is null.static voidregisterType(ModelBuilder modelBuilder) voidremoveAttribute(String attributeName) Removes attribute by name.voidremoveAttributeNs(String namespaceUri, String attributeName) Removes the attribute by name and namespace.booleanRemoves the child element from this.voidreplaceChildElement(ModelElementInstance existingChild, ModelElementInstance newChild) Replace an existing child element with a new child element.voidreplaceWithElement(ModelElementInstance newElement) Replaces this element with a new element and updates references.voidsetAttributeValue(String attributeName, String xmlValue) Sets the value by name of a non-ID attribute.voidsetAttributeValue(String attributeName, String xmlValue, boolean isIdAttribute) Sets attribute value by name.voidsetAttributeValue(String attributeName, String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate) Sets attribute value by name.voidsetAttributeValueNs(String namespaceUri, String attributeName, String xmlValue) Sets the value by name and namespace of a non-ID attribute.voidsetAttributeValueNs(String namespaceUri, String attributeName, String xmlValue, boolean isIdAttribute) Sets the attribute value by name and namespace.voidsetAttributeValueNs(String namespaceUri, String attributeName, String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate) Sets the attribute value by name and namespace.voidsetTextContent(String textContent) Sets the text content of the DOM elementvoidAdds or replaces a child element by name.voidExecute 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:ModelElementInstanceReturns the represented DOMDomElement.- Specified by:
getDomElementin interfaceModelElementInstance- Returns:
- the DOM element
-
getModelInstance
Description copied from interface:ModelElementInstanceReturns the model instance which contains this type instance.- Specified by:
getModelInstancein interfaceModelElementInstance- Returns:
- the model instance
-
getParentElement
Description copied from interface:ModelElementInstanceReturns the parent element of this.- Specified by:
getParentElementin interfaceModelElementInstance- Returns:
- the parent element
-
getElementType
Description copied from interface:ModelElementInstanceReturns the element type of this.- Specified by:
getElementTypein interfaceModelElementInstance- Returns:
- the element type
-
getAttributeValue
Description copied from interface:ModelElementInstanceReturns the attribute value for the attribute name.- Specified by:
getAttributeValuein interfaceModelElementInstance- Parameters:
attributeName- the name of the attribute- Returns:
- the value of the attribute
-
getAttributeValueNs
Description copied from interface:ModelElementInstanceReturns the attribute value for the given attribute name and namespace URI.- Specified by:
getAttributeValueNsin 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:ModelElementInstanceSets the value by name of a non-ID attribute.- Specified by:
setAttributeValuein interfaceModelElementInstance- Parameters:
attributeName- the name of the attributexmlValue- the value to set
-
setAttributeValue
Description copied from interface:ModelElementInstanceSets attribute value by name.- Specified by:
setAttributeValuein 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:ModelElementInstanceSets attribute value by name.- Specified by:
setAttributeValuein 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:ModelElementInstanceSets the value by name and namespace of a non-ID attribute.- Specified by:
setAttributeValueNsin 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:ModelElementInstanceSets the attribute value by name and namespace.- Specified by:
setAttributeValueNsin 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:ModelElementInstanceSets the attribute value by name and namespace.- Specified by:
setAttributeValueNsin 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:ModelElementInstanceRemoves attribute by name.- Specified by:
removeAttributein interfaceModelElementInstance- Parameters:
attributeName- the name of the attribute
-
removeAttributeNs
Description copied from interface:ModelElementInstanceRemoves the attribute by name and namespace.- Specified by:
removeAttributeNsin interfaceModelElementInstance- Parameters:
namespaceUri- the namespace URI of the attributeattributeName- the name of the attribute
-
getTextContent
Description copied from interface:ModelElementInstanceReturns the text content of the DOM element without leading and trailing spaces. For raw text content seegetRawTextContent().- Specified by:
getTextContentin interfaceModelElementInstance- Returns:
- text content of underlying DOM element with leading and trailing whitespace trimmed
-
setTextContent
Description copied from interface:ModelElementInstanceSets the text content of the DOM element- Specified by:
setTextContentin interfaceModelElementInstance- Parameters:
textContent- the new text content
-
getRawTextContent
Description copied from interface:ModelElementInstanceReturns the raw text content of the DOM element including all whitespaces.- Specified by:
getRawTextContentin interfaceModelElementInstance- Returns:
- raw text content of underlying DOM element
-
getUniqueChildElementByNameNs
Description copied from interface:ModelElementInstanceReturns a child element with the given name or 'null' if no such element exists- Specified by:
getUniqueChildElementByNameNsin 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:ModelElementInstanceReturns a child element with the given type- Specified by:
getUniqueChildElementByTypein interfaceModelElementInstance- Parameters:
elementType- the type of the element- Returns:
- the child element or null
-
setUniqueChildElementByNameNs
Description copied from interface:ModelElementInstanceAdds 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:
setUniqueChildElementByNameNsin interfaceModelElementInstance- Parameters:
newChild- the child to add
-
replaceChildElement
Description copied from interface:ModelElementInstanceReplace an existing child element with a new child element. Changes the underlying DOM element tree.- Specified by:
replaceChildElementin interfaceModelElementInstance- Parameters:
existingChild- the child element to replacenewChild- the new child element
-
replaceWithElement
Description copied from interface:ModelElementInstanceReplaces this element with a new element and updates references.- Specified by:
replaceWithElementin interfaceModelElementInstance- Parameters:
newElement- the new element to replace with
-
addChildElement
Description copied from interface:ModelElementInstanceAdds 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:
addChildElementin interfaceModelElementInstance- Parameters:
newChild- the new child element
-
removeChildElement
Description copied from interface:ModelElementInstanceRemoves the child element from this.- Specified by:
removeChildElementin interfaceModelElementInstance- Parameters:
child- the child element to remove- Returns:
- true if the child element could be removed
-
getChildElementsByType
Description copied from interface:ModelElementInstanceReturn all child elements of a given type- Specified by:
getChildElementsByTypein 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:ModelElementInstanceReturn all child elements of a given type- Specified by:
getChildElementsByTypein 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:ModelElementInstanceInserts the new element after the given element or at the beginning if the given element is null.- Specified by:
insertElementAfterin 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:ModelElementInstanceExecute updates after the element was inserted as a replacement of another element.- Specified by:
updateAfterReplacementin interfaceModelElementInstance
-
asSet
-
hashCode
public int hashCode() -
equals
-