Ejemplo n.º 1
0
        internal bool TryGetDimensionNodeForRole(string currentLanguage, string currentLabelRole,
                                                 string roleId, out DimensionNode topLevelNode)
        {
            topLevelNode = null;
            DefinitionLink dl = definitionLinks[roleId] as DefinitionLink;

            if (dl != null)
            {
                string label = dl.Title;


                topLevelNode = new DimensionNode(label);
                topLevelNode.MyDefinitionLink = dl;
                if (dl.HypercubeLocatorsHrefs.Count > 0)
                {
                    foreach (string hypercubeHref in dl.HypercubeLocatorsHrefs)
                    {
                        DimensionNode hyperCubeNode;
                        if (dl.TryGetHypercubeNode(currentLanguage, currentLabelRole, this.definitionLinks,
                                                   hypercubeHref, false, out hyperCubeNode))
                        {
                            topLevelNode.AddChild(hyperCubeNode);
                        }
                    }
                }
                else
                {
                    //we might have to build the dimension nodes by itself...
                    if (dl.DimensionLocatorsHrefs.Count > 0)
                    {
                        foreach (string dimHref in dl.DimensionLocatorsHrefs)
                        {
                            DefinitionLocator dloc;
                            if (!dl.TryGetLocator(dimHref, out dloc))
                            {
                                return(false);
                            }

                            DimensionNode dn = dloc.CreateDimensionNode(currentLanguage, currentLabelRole,
                                                                        null, dimHref, dl, true, definitionLinks, null, null, true, false);

                            if (dn != null)
                            {
                                topLevelNode.AddChild(dn);
                            }
                        }
                    }
                }
            }

            return(topLevelNode != null);
        }
Ejemplo n.º 2
0
        internal bool TryGetHypercubeNode(string currentLanguage, string currentLabelRole,
                                          string role,
                                          string hypercubeId,
                                          bool buildnew,
                                          out DimensionNode hypercubeNode)
        {
            hypercubeNode = null;
            DefinitionLink dl = definitionLinks[role] as DefinitionLink;

            if (dl != null)
            {
                if (dl.TryGetHypercubeNode(currentLanguage, currentLabelRole, this.definitionLinks,
                                           hypercubeId, buildnew, out hypercubeNode))
                {
                    return(true);
                }

                return(false);
            }

            return(false);
        }