use of org.camunda.bpm.model.xml.instance.DomElement in project camunda-bpmn-model by camunda.
the class CamundaListImpl method getValues.
@SuppressWarnings("unchecked")
public <T extends BpmnModelElementInstance> Collection<T> getValues() {
return new Collection<T>() {
protected Collection<T> getElements() {
return ModelUtil.getModelElementCollection(getDomElement().getChildElements(), getModelInstance());
}
public int size() {
return getElements().size();
}
public boolean isEmpty() {
return getElements().isEmpty();
}
public boolean contains(Object o) {
return getElements().contains(o);
}
public Iterator<T> iterator() {
return (Iterator<T>) getElements().iterator();
}
public Object[] toArray() {
return getElements().toArray();
}
public <T1> T1[] toArray(T1[] a) {
return getElements().toArray(a);
}
public boolean add(T t) {
getDomElement().appendChild(t.getDomElement());
return true;
}
public boolean remove(Object o) {
ModelUtil.ensureInstanceOf(o, BpmnModelElementInstance.class);
return getDomElement().removeChild(((BpmnModelElementInstance) o).getDomElement());
}
public boolean containsAll(Collection<?> c) {
for (Object o : c) {
if (!contains(o)) {
return false;
}
}
return true;
}
public boolean addAll(Collection<? extends T> c) {
for (T element : c) {
add(element);
}
return true;
}
public boolean removeAll(Collection<?> c) {
boolean result = false;
for (Object o : c) {
result |= remove(o);
}
return result;
}
public boolean retainAll(Collection<?> c) {
throw new UnsupportedModelOperationException("retainAll()", "not implemented");
}
public void clear() {
DomElement domElement = getDomElement();
List<DomElement> childElements = domElement.getChildElements();
for (DomElement childElement : childElements) {
domElement.removeChild(childElement);
}
}
};
}
use of org.camunda.bpm.model.xml.instance.DomElement in project camunda-bpmn-model by camunda.
the class CamundaGenericValueElementImpl method removeValue.
public void removeValue() {
DomElement domElement = getDomElement();
List<DomElement> childElements = domElement.getChildElements();
for (DomElement childElement : childElements) {
domElement.removeChild(childElement);
}
}
use of org.camunda.bpm.model.xml.instance.DomElement in project camunda-xml-model by camunda.
the class AttributeReferenceCollection method getView.
private Collection<DomElement> getView(ModelElementInstance referenceSourceElement) {
DomDocument document = referenceSourceElement.getModelInstance().getDocument();
String identifier = getReferenceIdentifier(referenceSourceElement);
List<String> references = StringUtil.splitListBySeparator(identifier, separator);
Collection<DomElement> referenceTargetElements = new ArrayList<DomElement>();
for (String reference : references) {
DomElement referenceTargetElement = document.getElementById(reference);
if (referenceTargetElement != null) {
referenceTargetElements.add(referenceTargetElement);
} else {
throw new ModelException("Unable to find a model element instance for id " + identifier);
}
}
return referenceTargetElements;
}
use of org.camunda.bpm.model.xml.instance.DomElement in project camunda-xml-model by camunda.
the class DomDocumentImpl method setRootElement.
public void setRootElement(DomElement rootElement) {
synchronized (document) {
Element documentElement = document.getDocumentElement();
Element newDocumentElement = ((DomElementImpl) rootElement).getElement();
if (documentElement != null) {
document.replaceChild(newDocumentElement, documentElement);
} else {
document.appendChild(newDocumentElement);
}
}
}
use of org.camunda.bpm.model.xml.instance.DomElement in project camunda-xml-model by camunda.
the class DomDocumentImpl method createElement.
public DomElement createElement(String namespaceUri, String localName) {
synchronized (document) {
XmlQName xmlQName = new XmlQName(this, namespaceUri, localName);
Element element = document.createElementNS(xmlQName.getNamespaceUri(), xmlQName.getPrefixedName());
return new DomElementImpl(element);
}
}
Aggregations