protected Artifact GetArtifactInSubProcess(string id, SubProcess subProcess) { Artifact foundArtifact = subProcess.GetArtifact(id); if (foundArtifact == null) { foreach (FlowElement flowElement in subProcess.GetFlowElements()) { if (flowElement is SubProcess) { foundArtifact = GetArtifactInSubProcess(id, (SubProcess)flowElement); if (foundArtifact != null) { break; } } } } return(foundArtifact); }
public List <FlowElementType> FindFlowElementsInSubProcessOfType <FlowElementType>(SubProcess subProcess, bool goIntoSubprocesses) where FlowElementType : FlowElement { List <FlowElementType> foundFlowElements = new List <FlowElementType>(); foreach (FlowElement flowElement in subProcess.GetFlowElements()) { if (flowElement.GetType() == typeof(FlowElementType)) { foundFlowElements.Add((FlowElementType)flowElement); } if (flowElement is SubProcess) { if (goIntoSubprocesses) { foundFlowElements.AddRange(FindFlowElementsInSubProcessOfType <FlowElementType>((SubProcess)flowElement)); } } } return(foundFlowElements); }