Пример #1
0
        /// <summary>
        ///
        /// </summary>
        private void exportElementGraph()
        {
            StreamWriter grphsw = null;

            try
            {
                grphsw = new StreamWriter(outputDir + "\\" + "graphdata.dat", false, System.Text.Encoding.GetEncoding("utf-8"));

                // Elementノードの出力
                List <ElementSearchItem> elementSearches = getElementSearcheItems();

                foreach (ElementSearchItem elemSrch in elementSearches)
                {
                    grphsw.Write("CREATE (" + "E" + elemSrch.elementId + ":Element ");
                    grphsw.Write("{ name:\"" + elemSrch.elemName + "\",");
                    grphsw.Write(" id:" + elemSrch.elementId + ",");
                    grphsw.Write(" path:\"" + elemSrch.elemPath + "\" ");
                    grphsw.WriteLine("});");
                }


                // Element間の接続情報を追加
                ConnectorSearcher connectorSearcher = new ConnectorSearcher();

                // 抽出されたElementSearchItem のGUIDをキーとして、Connector情報を調べる
                foreach (ElementSearchItem elemSrch in elementSearches)
                {
                    List <ConnectorVO> elemConnectors = connectorSearcher.findByObjectGuid(elemSrch.elemGuid);

                    foreach (ConnectorVO conn in elemConnectors)
                    {
                        // 自オブジェクトがsrcの場合のみ
                        if (conn.srcObjId == elemSrch.elementId)
                        {
                            // 2ノードのMATCHと、MATCHされた2ノード間にリレーションを設定する以下のようなCypher文を出力:
                            // MATCH (src:Element{id:9999}),(dst:Element{id:9999}) CREATE (src)-[:Association]->(dst);
                            grphsw.Write("MATCH (src:Element{id:" + conn.srcObjId + "}), ");
                            grphsw.Write("(dst:Element{id:" + conn.destObjId + "}) ");
                            grphsw.WriteLine("CREATE (src)-[:" + conn.connectorType + "]->(dst)");
                            grphsw.WriteLine(";");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Message=" + ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
            finally
            {
                if (grphsw != null)
                {
                    grphsw.Close();
                }
            }
        }
Пример #2
0
        public ArtifactXmlReader(string project_dir)
        {
            // 内部DBからの接続情報検索オブジェクトを生成
            if (this.connSearcher == null && ProjectSetting.getVO() != null)
            {
                this.connSearcher = new ConnectorSearcher();
            }

            this.projectPath = project_dir;
        }
Пример #3
0
        public ArtifactAsciidocWriter(string asciidocDir)
        {
            string dbFilePath = ProjectSetting.getVO().projectPath + "\\" + ProjectSetting.getVO().dbName;

            this.elementSearcher = new ElementSearcher(dbFilePath);
            this.connSearcher    = new ConnectorSearcher(dbFilePath);

            this.asciidocDir = asciidocDir;

            // Asciidoc出力フォルダの存在チェック&無ければ作成
            makeAsciidocDirIfNotExist(asciidocDir);
        }
        public ElementsXmlReader()
        {
            string target_dir  = ConfigurationManager.AppSettings["artifact_dir"];
            string target_file = ConfigurationManager.AppSettings["elements_file"];
            string fileName    = target_dir + "/" + target_file;

            if (connSearcher == null)
            {
                this.connSearcher = new ConnectorSearcher();
            }

            // XMLテキストをロードする
            this.xmlDoc = new XmlDocument();
            this.xmlDoc.Load(fileName);
        }
Пример #5
0
        private static void writePlantUml(ElementVO element, StreamWriter sw)
        {
            sw.WriteLine("");
            // sw.WriteLine("[plantuml, images/" + element.guid.Substring(1,8) + ", svg]");
            sw.WriteLine("[plantuml, img-" + element.guid.Substring(1, 13) + ", png]");
            sw.WriteLine("--");
            sw.WriteLine("@startuml");

            sw.WriteLine("class \"" + filterSpecialChar(element.name) + "\" " + getStereotypeStr(element.stereoType) + " {");

            if (element.attributes != null)
            {
                foreach (AttributeVO attr in element.attributes)
                {
                    sw.WriteLine("  " + getVisibilitySymbol(attr.visibility) + " " + attr.name + "");
                }
            }

            if (element.methods != null)
            {
                foreach (MethodVO mth in element.methods)
                {
                    sw.WriteLine("  " + getVisibilitySymbol(mth.visibility) + " " + mth.name + "()");
                }
            }

            sw.WriteLine("}");

            ElementSearcher elemSrch = new ElementSearcher();

            // DBからこの要素につながっている接続情報を取得
            ConnectorSearcher  searcher = new ConnectorSearcher();
            List <ConnectorVO> conns    = searcher.findByObjectGuid(element.guid);

            Dictionary <string, ElementSearchItem> nameHash = new Dictionary <string, ElementSearchItem>();

            List <ConnectorVO> srcConnList  = new List <ConnectorVO>();
            List <ConnectorVO> destConnList = new List <ConnectorVO>();

            foreach (ConnectorVO cn in conns)
            {
                if (cn.srcObjGuid == element.guid)
                {
                    srcConnList.Add(cn);
                    outputConnDestClass(cn.destObjGuid, elemSrch, nameHash, sw);
                }

                if (cn.destObjGuid == element.guid)
                {
                    destConnList.Add(cn);
                    outputConnDestClass(cn.srcObjGuid, elemSrch, nameHash, sw);
                }
            }


            for (var i = 0; i < srcConnList.Count; i++)
            {
                outputSrcConnectLine(srcConnList[i], sw);
            }

            for (var i = 0; i < destConnList.Count; i++)
            {
                outputDestConnectLine(destConnList[i], sw);
            }

            sw.WriteLine("@enduml");
            sw.WriteLine("--");
            sw.WriteLine("");
        }
        /// <summary>
        /// 自クラスから参照できる識別子を検索し、補完ウィンドウに出力する。
        /// </summary>
        /// <param name="elementVO"></param>
        /// <returns></returns>
        public IList <ICompletionData> searchCompletionDataFromMyOwn(ElementVO elementVO)
        {
            IList <ICompletionData> retDatas = new List <ICompletionData>();
            double priority = 1.0;

            // 自要素が保持する属性を取得して追加
            foreach (AttributeVO attr in elementVO.attributes)
            {
                string content     = "this." + attr.name;
                string description = attr.notes;

                string text = "this." + attr.name;
                retDatas.Add(new CompletionData(content, description, bitmapAttr, priority++, text));
            }

            // 自要素が保持する操作を取得して追加
            foreach (MethodVO mth in elementVO.methods)
            {
                string content     = "this." + mth.name;
                string description = mth.notes;

                string text = "this." + mth.name + "(" + getParameterString(mth.parameters) + ")";
                retDatas.Add(new CompletionData(content, description, bitmapMth, priority++, text));
            }

            // 自要素の接続先要素を全て抽出
            ConnectorSearcher  connSearcher = new ConnectorSearcher();
            List <ConnectorVO> retConns     = connSearcher.findByObjectGuid(elementVO.guid);

            foreach (ConnectorVO cn in retConns)
            {
                string targetName = "";

                switch (cn.connectorType)
                {
                // 依存線、関連線で自分が src側の場合は destのオブジェクト名を取得
                case "Dependency":
                case "Association":
                    if (cn.srcObjGuid == elementVO.guid)
                    {
                        targetName = cn.destObjName;
                    }
                    break;

                // 集約線で自分が dest側の場合は srcのオブジェクト名を取得
                case "Aggregation":
                    if (cn.destObjGuid == elementVO.guid)
                    {
                        targetName = cn.srcObjName;
                    }
                    break;
                }

                // 得られた名前が空でなかったら、候補として追加
                if (targetName != "")
                {
                    retDatas.Add(new CompletionData(targetName, targetName, null, priority++, targetName));
                }
            }

            return(retDatas);
        }