Пример #1
0
        private List <Association> FindAssociationsWithTargetRefRecursive(IFlowElementsContainer flowElementsContainer, string targetRef)
        {
            List <Association> associations = new List <Association>();

            foreach (Artifact artifact in flowElementsContainer.GetArtifacts())
            {
                if (artifact is Association)
                {
                    Association association = (Association)artifact;
                    if (association.TargetRef != null && association.TargetRef == targetRef)
                    {
                        associations.Add(association);
                    }
                }
            }

            foreach (FlowElement flowElement in flowElementsContainer.GetFlowElements())
            {
                if (flowElement is IFlowElementsContainer)
                {
                    associations.AddRange(FindAssociationsWithTargetRefRecursive((IFlowElementsContainer)flowElement, targetRef));
                }
            }
            return(associations);
        }
Пример #2
0
 public IFlowElementsContainer FindParent(FlowElement childElement, IFlowElementsContainer flowElementsContainer)
 {
     foreach (FlowElement flowElement in flowElementsContainer.GetFlowElements())
     {
         if (childElement.Id != null && childElement.Id == flowElement.Id)
         {
             return(flowElementsContainer);
         }
         if (flowElement is IFlowElementsContainer)
         {
             IFlowElementsContainer result = FindParent(childElement, (IFlowElementsContainer)flowElement);
             if (result != null)
             {
                 return(result);
             }
         }
     }
     return(null);
 }
Пример #3
0
 private IFlowElementsContainer GetFlowElementsContainer(IFlowElementsContainer flowElementsContainer, string flowElementId)
 {
     foreach (FlowElement flowElement in flowElementsContainer.GetFlowElements())
     {
         if (flowElement.Id != null && flowElement.Id == flowElementId)
         {
             return(flowElementsContainer);
         }
         else if (flowElement is IFlowElementsContainer)
         {
             IFlowElementsContainer result = GetFlowElementsContainer((IFlowElementsContainer)flowElement, flowElementId);
             if (result != null)
             {
                 return(result);
             }
         }
     }
     return(null);
 }