use of org.camunda.bpm.model.xml.instance.DomDocument in project camunda-xml-model by camunda.
the class ElementReferenceCollectionImpl method getView.
protected Collection<DomElement> getView(ModelElementInstanceImpl referenceSourceParentElement) {
DomDocument document = referenceSourceParentElement.getModelInstance().getDocument();
Collection<Source> referenceSourceElements = referenceSourceCollection.get(referenceSourceParentElement);
Collection<DomElement> referenceTargetElements = new ArrayList<DomElement>();
for (Source referenceSourceElement : referenceSourceElements) {
String identifier = getReferenceIdentifier(referenceSourceElement);
DomElement referenceTargetElement = document.getElementById(identifier);
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.DomDocument in project camunda-xml-model by camunda.
the class IdsElementReferenceCollectionImpl method getView.
@Override
protected Collection<DomElement> getView(ModelElementInstanceImpl referenceSourceParentElement) {
DomDocument document = referenceSourceParentElement.getModelInstance().getDocument();
Collection<Source> referenceSourceElements = getReferenceSourceCollection().get(referenceSourceParentElement);
Collection<DomElement> referenceTargetElements = new ArrayList<DomElement>();
for (Source referenceSourceElement : referenceSourceElements) {
List<String> identifiers = getReferenceIdentifiers(referenceSourceElement);
for (String identifier : identifiers) {
DomElement referenceTargetElement = document.getElementById(identifier);
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.DomDocument 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.DomDocument in project camunda-xml-model by camunda.
the class UnknownAnimalTest method validateModel.
@After
public void validateModel() {
DomDocument document = modelInstance.getDocument();
modelParser.validateModel(document);
}
use of org.camunda.bpm.model.xml.instance.DomDocument in project camunda-xml-model by camunda.
the class AbstractModelParser method parseModelFromStream.
public ModelInstance parseModelFromStream(InputStream inputStream) {
DomDocument document = null;
synchronized (documentBuilderFactory) {
document = DomUtil.parseInputStream(documentBuilderFactory, inputStream);
}
validateModel(document);
return createModelInstance(document);
}
Aggregations