//Returns all connections which refer to the selcted elements either way private static List<XmlSbpmConnection> searchConnectionsForElement(XmlSbpmEntireModelSubject model, XmlSbpmModelingElement selectedObject) { List<XmlSbpmConnection> connFound = new List<XmlSbpmConnection>(); ; foreach (XmlSbpmConnection connection in model.Connection) { if (connection.endPoint2.UUID.Equals(selectedObject.UUID)) { connFound.Add(connection); } } return connFound; }
public static List<XmlSbpmModelingElement> getDirectSuccessor(XmlSbpmEntireModelSubject model, XmlSbpmModelingElement selectedObject) { List<XmlSbpmModelingElement> successingObjects = new List<XmlSbpmModelingElement>(); foreach (XmlSbpmModelingElement obj in model.Element) { if (obj.UUID.Equals(selectedObject.UUID)) { List<XmlSbpmConnection> connections = searchConnectionsForElement(model, selectedObject); successingObjects = findElementsUsedInConnections(model, connections, selectedObject); } } return successingObjects; }
static void Main(string[] args) { subjectsModel1 = Subject.compareSubjectsWithtinModelAskForCommonSubjects(); subjectsModel1 = Subject.findCommonNameForSubjects(subjectsModel1); Subject.exportModel(subjectsModel1); XmlSbpmEntireModelSubject model = subjectsModel1.ElementAt(0).ElementAt(0) as XmlSbpmEntireModelSubject; XmlSbpmModelingElement obj = new XmlSbpmModelingElement(); obj.UUID = "0"; Object.printElements(Object.getDirectSuccessor(model, obj)); Console.WriteLine("Press Any Key To Exit"); Console.ReadKey(); Environment.Exit(0); }
private static List<XmlSbpmModelingElement> findElementsUsedInConnections(XmlSbpmEntireModelSubject model, List<XmlSbpmConnection> connections, XmlSbpmModelingElement selectedObject) { List<XmlSbpmModelingElement> elements = new List<XmlSbpmModelingElement>(); foreach (XmlSbpmConnection con in connections) { foreach (XmlSbpmModelingElement element in model.Element) { if (element.UUID.Equals(con.endPoint1.UUID) && !element.UUID.Equals(selectedObject.UUID) || element.UUID.Equals(con.endPoint2.UUID) && !element.UUID.Equals(selectedObject.UUID)) { elements.Add(element); } } } return elements; }