示例#1
0
        private static ISet <ICategorisationObject> GetCategorisations(
            IMaintainableObject maintainable, IEnumerable <ICategorisationObject> categorisations)
        {
            ISet <ICategorisationObject> returnSet = new HashSet <ICategorisationObject>();

            if (maintainable.IsExternalReference.IsTrue)
            {
                return(returnSet);
            }

            /* foreach */
            foreach (ICategorisationObject cat in categorisations)
            {
                if (cat.IsExternalReference.IsTrue)
                {
                    continue;
                }

                if (cat.StructureReference.TargetReference.EnumType == maintainable.StructureType.EnumType)
                {
                    if (MaintainableUtil <IMaintainableObject> .Match(maintainable, cat.StructureReference))
                    {
                        returnSet.Add(cat);
                    }
                }
            }

            return(returnSet);
        }
        private List <JsTreeNode> BuildJSTree(ISdmxObjects SdmxOBJ, string TwoLetterISO)
        {
            var categorisedDataflowIndex = new Dictionary <string, IDataflowObject>();
            var uncategorisedDataflow    = new List <IDataflowObject>();
            var nodeList = new List <JsTreeNode>();

            // for each dataflows control if has a categorization
            // if true put it in dataflow list or in uncategorizate list
            foreach (IDataflowObject d in SdmxOBJ.Dataflows)
            {
                if (!d.IsExternalReference.IsTrue &&
                    SdmxOBJ.Categorisations.Count(cat => !cat.IsExternalReference.IsTrue && cat.StructureReference.TargetReference.EnumType == d.StructureType.EnumType && MaintainableUtil <IMaintainableObject> .Match(d, cat.StructureReference)) == 0)
                {
                    uncategorisedDataflow.Add(d);
                }
                else
                {
                    categorisedDataflowIndex.Add(Utils.MakeKey(d), d);
                }
            }


            nodeList.AddRange(CreateCategorisedNodes(SdmxOBJ, categorisedDataflowIndex, TwoLetterISO));

            if (TreeObj.Configuration.UseUncategorysed)
            {
                var uncategorisedNode = new JsTreeNode();
                uncategorisedNode.SetRel("category-scheme");
                uncategorisedNode.type = "category-scheme";
                uncategorisedNode.SetId("uncategorised");
                uncategorisedNode.text = Messages.text_dataflows_uncategorized;
                foreach (IDataflowObject dataflow in uncategorisedDataflow)
                {
                    JsTreeNode node = CreateDataflowNode(dataflow, SdmxOBJ, TwoLetterISO);
                    if (node != null)
                    {
                        uncategorisedNode.children.Add(node);
                    }
                }
                if (uncategorisedNode.children.Count > 0)
                {
                    nodeList.Add(uncategorisedNode);
                }
            }
            return(nodeList);
        }