public UmlTransition buscaTransition(String id, Dictionary <String, UmlActionStateDiagram> dicActionDiagram)
        {
            foreach (String keyDiagram in dicActionDiagram.Keys)
            {
                UmlActionStateDiagram d = dicActionDiagram[keyDiagram];

                foreach (String keyTransition in d.transitions.Keys)
                {
                    if (id.Equals(keyTransition))
                    {
                        UmlTransition t = d.transitions[keyTransition];
                        return(t);
                    }
                }
            }
            return(null);
        }
Ejemplo n.º 2
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;
                }
            }
        }
        public static Dictionary <String, UmlActionStateDiagram> ParseActivityDiagram(XmlDocument doc)
        {
            UmlActionStateDiagram.collectJudeHyperLinksReferences(doc);
            Dictionary <String, UmlActionStateDiagram> dictionaryActivityDiagram = new Dictionary <string, UmlActionStateDiagram>();


            foreach (XmlNode activityDiagramNode in doc.SelectNodes("//UML:Model//UML:ActivityGraph", ns))
            {
                if (activityDiagramNode.Attributes["xmi.id"] != null)
                {
                    UmlActionStateDiagram activityDiagram = new UmlActionStateDiagram();
                    activityDiagram.Name        = activityDiagramNode.Attributes["name"].Value;
                    activityDiagram.Id          = activityDiagramNode.Attributes["xmi.id"].Value;
                    activityDiagram.transitions = UmlTransition.ParserTransition(activityDiagramNode, activityDiagram.Id);
                    dictionaryActivityDiagram.Add(activityDiagram.Id, activityDiagram);
                    UmlActionState.ParseActivity(activityDiagramNode, activityDiagram.Id, activityDiagram);
                    activityDiagram.InitialActivity = UmlInitialState.ParserPseudostate(activityDiagramNode, activityDiagram.Id);
                    activityDiagram.FinalActivity   = UmlFinalState.ParserFinalState(activityDiagramNode, activityDiagram.Id);
                }
            }
            foreach (var item in dictionaryActivityDiagram.Keys)
            {
                foreach (var item2 in dictionaryActivityDiagram[item].dicAtivities.Keys)
                {
                    UmlActionState activity = dictionaryActivityDiagram[item].dicAtivities[item2];
                    foreach (String item3 in activity.dicJudeHyperLink.Keys)
                    {
                        //Id UML
                        String key = UmlActionStateDiagram.dicJudeHyperLinks[item3];
                        UmlActionStateDiagram diagram = dictionaryActivityDiagram[key];
                        activity.dicMyLinkedDiagrams.Add(diagram.Id, diagram);
                    }
                }
            }

            return(dictionaryActivityDiagram);
        }
Ejemplo n.º 4
0
        public static Dictionary <String, UmlUseCase> ParseUseCase(XmlNode node, Dictionary <String, UmlActionStateDiagram> dicActionDiagram, XmlDocument doc)
        {
            Dictionary <String, UmlUseCase> dictionaryUseCase = new Dictionary <string, UmlUseCase>();

            foreach (XmlNode useCaseNode in node.SelectNodes("//UML:Model/*/UML:UseCase", ns))
            {
                UmlUseCase usecase = new UmlUseCase();
                usecase.Name = useCaseNode.Attributes["name"].Value;
                usecase.Id   = useCaseNode.Attributes["xmi.id"].Value;

                foreach (XmlNode NodeTag in node.SelectNodes("//UML:Model/*/UML:UseCase[@xmi.id='" + usecase.Id + "']//UML:TaggedValue", ns))
                {
                    try
                    {
                        UmlTag tag = new UmlTag();
                        tag.id   = NodeTag.Attributes["xmi.id"].Value;
                        tag.name = NodeTag.Attributes["tag"].Value;

                        if (NodeTag.Attributes["value"] != null)
                        {
                            tag.value = NodeTag.Attributes["value"].Value;
                        }

                        switch (NodeTag.Attributes["tag"].Value)
                        {
                        case "FTpostConditions":
                            if (NodeTag.Attributes["value"] != null)
                            {
                                usecase.posCondition = NodeTag.Attributes["value"].Value;
                            }
                            break;

                        case "FTpreConditions":
                            usecase.dictionaryTag.Add(tag.id, tag);
                            break;

                        case "FTstate":
                            if (NodeTag.Attributes["value"] != null)
                            {
                                usecase.FTstate = NodeTag.Attributes["value"].Value;
                            }
                            break;

                        case "FTassigned":
                            if (NodeTag.Attributes["value"] != null)
                            {
                                usecase.FTassigned = NodeTag.Attributes["value"].Value;
                            }
                            break;

                        case "FTreason":
                            if (NodeTag.Attributes["value"] != null)
                            {
                                usecase.FTreason = NodeTag.Attributes["value"].Value;
                            }
                            break;

                        case "FTiterationPath":
                            if (NodeTag.Attributes["value"] != null)
                            {
                                usecase.FTiterationPath = NodeTag.Attributes["value"].Value;
                            }
                            break;

                        case "FTareaPath":
                            if (NodeTag.Attributes["value"] != null)
                            {
                                usecase.FTareaPath = NodeTag.Attributes["value"].Value;
                            }
                            break;

                        case "FTapplication":
                            if (NodeTag.Attributes["value"] != null)
                            {
                                usecase.FTapplication = NodeTag.Attributes["value"].Value;
                            }
                            break;

                        case "FTcomplexity":
                            if (NodeTag.Attributes["value"] != null)
                            {
                                usecase.FTcomplexity = NodeTag.Attributes["value"].Value;
                            }
                            break;

                        case "FTrisks":
                            if (NodeTag.Attributes["value"] != null)
                            {
                                usecase.FTrisks = NodeTag.Attributes["value"].Value;
                            }
                            break;

                        case "FTtcLifecycle":
                            if (NodeTag.Attributes["value"] != null)
                            {
                                usecase.FTtcLifecycle = NodeTag.Attributes["value"].Value;
                            }
                            break;

                        case "FTlifecycleType":
                            if (NodeTag.Attributes["value"] != null)
                            {
                                usecase.FTlifecycleType = NodeTag.Attributes["value"].Value;
                            }
                            break;

                        case "FTtcTeamUsage":
                            if (NodeTag.Attributes["value"] != null)
                            {
                                usecase.FTtcTeamUsage = NodeTag.Attributes["value"].Value;
                            }
                            break;

                        case "jude.hyperlink":
                            tag.value = retiraCabecalhoECauda(tag.value);
                            UmlActionStateDiagram umlTD = usecase.getActionStateDiagram(tag.value, dicActionDiagram);
                            usecase.dicTagHyperLinkUseCase.Add(tag.id, umlTD);
                            break;

                        default:
                            DialogResult dialogResult = MessageBox.Show("Use case" + usecase.Name + " has a invalid Tag. Are you sure you want to continue executing a parsing method?", "Error", MessageBoxButtons.YesNo);

                            if (dialogResult == DialogResult.No)
                            {
                                throw new InvalidTag();
                            }
                            break;
                        }
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show("Error" + e.Message);
                    }
                }

                foreach (XmlNode include in node.SelectNodes("//UML:Model/*/UML:UseCase[@xmi.id='" + usecase.Id + "']//UML:UseCase.include//UML:Include", ns))
                {
                    usecase.includeList.Add(include.Attributes["xmi.idref"].Value);
                }

                dictionaryUseCase.Add(usecase.Id, usecase);
            }

            return(dictionaryUseCase);
        }