コード例 #1
0
        public static void ParseActivity(XmlNode node, String id, UmlActionStateDiagram activityDiagram)
        {
            foreach (XmlNode ActionStateNode in node.SelectNodes("//UML:ActivityGraph[@xmi.id='" + id + "']//UML:ActionState", ns))
            {
                UmlActionState activity = new UmlActionState();
                activity.Id   = ActionStateNode.Attributes["xmi.id"].Value;
                activity.Name = ActionStateNode.Attributes["name"].Value;
                activityDiagram.dicAtivities.Add(activity.Id, activity);

                UmlTag.ParserTag(ActionStateNode, ns, activity);

                foreach (XmlNode NodeStateVertex in ActionStateNode.SelectNodes("//UML:ActionState[@xmi.id='" + activity.Id + "']//UML:StateVertex.outgoing//UML:Transition", ns))
                {
                    activity.outgoing = NodeStateVertex.Attributes["xmi.idref"].Value;
                }
                foreach (XmlNode NodeStateVertex in ActionStateNode.SelectNodes("//UML:ActionState[@xmi.id='" + activity.Id + "']//UML:StateVertex.incoming//UML:Transition", ns))
                {
                    activity.incoming = NodeStateVertex.Attributes["xmi.idref"].Value;
                }
            }
        }
コード例 #2
0
        public static void ParseActivityDiagram(XmlDocument doc, Dictionary <String, UmlActivityDiagram> dictionaryActivityDiagram)
        {
            UmlActivityDiagram.collectJudeHyperLinksReferences(doc);

            foreach (XmlNode activityDiagramNode in doc.SelectNodes("//UML:Model//UML:ActivityGraph", ns))
            {
                try
                {
                    UmlActivityDiagram activityDiagram = new UmlActivityDiagram();
                    activityDiagram.Name = activityDiagramNode.Attributes["name"].Value;
                    activityDiagram.Id   = activityDiagramNode.Attributes["xmi.id"].Value;
                    dictionaryActivityDiagram.Add(activityDiagram.Id, activityDiagram);

                    foreach (XmlNode ActionStateNode in activityDiagramNode.SelectNodes("//UML:ActivityGraph[@xmi.id='" + activityDiagram.Id + "']//UML:ActionState", ns))
                    {
                        UmlActivity activity = new UmlActivity();
                        activity.Id   = ActionStateNode.Attributes["xmi.id"].Value;
                        activity.Name = ActionStateNode.Attributes["name"].Value;

                        foreach (XmlNode NodeHyperLink in ActionStateNode.SelectNodes("//UML:ActionState[@xmi.id='" + activity.Id + "']//UML:TaggedValue", ns))
                        {
                            UmlTag tag = new UmlTag();
                            tag.name = NodeHyperLink.Attributes["tag"].Value;
                            tag.id   = NodeHyperLink.Attributes["xmi.id"].Value;
                            activityDiagram.dicAtivities.Add(activity.Id, activity);

                            String hyperLink = NodeHyperLink.Attributes["value"].Value;

                            if (tag.name.Equals("jude.hyperlink"))
                            {
                                tag.hyperLink = retiraCabecalhoECauda(hyperLink);
                                activity.dicHyperLink.Add(tag.id, tag.hyperLink);
                            }
                            else
                            {
                                activity.dictionaryTag.Add(tag.id, tag);
                            }
                        }

                        foreach (XmlNode NodeStateVertex in ActionStateNode.SelectNodes("//UML:ActionState[@xmi.id='" + activity.Id + "']//UML:StateVertex.outgoing//UML:Transition", ns))
                        {
                            activity.outgoing = NodeStateVertex.Attributes["xmi.idref"].Value;
                        }
                        foreach (XmlNode NodeStateVertex in ActionStateNode.SelectNodes("//UML:ActionState[@xmi.id='" + activity.Id + "']//UML:StateVertex.incoming//UML:Transition", ns))
                        {
                            activity.incoming = NodeStateVertex.Attributes["xmi.idref"].Value;
                        }
                    }
                    activityDiagram.InitialActivity = UmlInitialActivity.ParserPseudostate(activityDiagramNode, activityDiagram.Id);
                    activityDiagram.FinalActivity   = UmlFinalActivity.ParserFinalState(activityDiagramNode, activityDiagram.Id);
                }catch (Exception) {}
            }

            foreach (var item in dictionaryActivityDiagram.Keys)
            {
                foreach (var item2 in dictionaryActivityDiagram[item].dicAtivities.Keys)
                {
                    dictionaryActivityDiagram[item].dicAtivities[item2].ActivityAssociationAtivityDiagram(dictionaryActivityDiagram);
                }
            }
        }