use of org.camunda.bpm.model.xml.type.reference.Reference in project camunda-bpmn-model by camunda.
the class FlowNodeImpl method updateAfterReplacement.
@SuppressWarnings("rawtypes")
public void updateAfterReplacement() {
super.updateAfterReplacement();
Collection<Reference> incomingReferences = getIncomingReferencesByType(SequenceFlow.class);
for (Reference<?> reference : incomingReferences) {
for (ModelElementInstance sourceElement : reference.findReferenceSourceElements(this)) {
String referenceIdentifier = reference.getReferenceIdentifier(sourceElement);
if (referenceIdentifier != null && referenceIdentifier.equals(getId()) && reference instanceof AttributeReference) {
String attributeName = ((AttributeReference) reference).getReferenceSourceAttribute().getAttributeName();
if (attributeName.equals(BPMN_ATTRIBUTE_SOURCE_REF)) {
getOutgoing().add((SequenceFlow) sourceElement);
} else if (attributeName.equals(BPMN_ATTRIBUTE_TARGET_REF)) {
getIncoming().add((SequenceFlow) sourceElement);
}
}
}
}
}
use of org.camunda.bpm.model.xml.type.reference.Reference in project camunda-bpmn-model by camunda.
the class BaseElementImpl method getIncomingReferencesByType.
@SuppressWarnings("rawtypes")
public Collection<Reference> getIncomingReferencesByType(Class<? extends ModelElementInstance> referenceSourceTypeClass) {
Collection<Reference> references = new ArrayList<Reference>();
// we traverse all incoming references in reverse direction
for (Reference<?> reference : idAttribute.getIncomingReferences()) {
ModelElementType sourceElementType = reference.getReferenceSourceElementType();
Class<? extends ModelElementInstance> sourceInstanceType = sourceElementType.getInstanceType();
// if the referencing element (source element) is a BPMNDI element, dig deeper
if (referenceSourceTypeClass.isAssignableFrom(sourceInstanceType)) {
references.add(reference);
}
}
return references;
}
Aggregations