public static <T extends BaseElement> T findBPMNObject(Definitions defs, QName ref,
Class<T> wantedClass) throws BPMNException {
if(ref!=null) {
if(ref.getNamespaceURI()==null || ref.getNamespaceURI().isEmpty()) {
return findObjectInDefinitions(defs, ref.getLocalPart(), wantedClass);
}
Import impt = defs.getImport(ref.getNamespaceURI());
if(impt!=null && impt.isBPMN20Import()) {
Definitions importedDefs = impt.getBPMNDefinitions();
return findObjectInDefinitions(importedDefs, ref.getLocalPart(), wantedClass);
}
}
throw new BPMNException("No bpmn element has been found for this QName : "+ref);
}