Example #1
0
        internal DefinitionLink CreateCopyForMerging()
        {
            DefinitionLink ret = new DefinitionLink();
            ret.role = this.role;
            ret.title = this.title;

            ret.BaseSchema = this.BaseSchema;
            ret.MyHref = this.MyHref;

            if (HypercubeLocatorsHrefs != null)
            {
                ret.HypercubeLocatorsHrefs = new List<string>(HypercubeLocatorsHrefs);
            }

            if (NotAllRelationshipHypercubes != null)
            {
                ret.NotAllRelationshipHypercubes = new List<string>(NotAllRelationshipHypercubes);
            }

            if (DimensionHrefsWithDefault != null)
            {
                ret.DimensionHrefsWithDefault = new List<string>(DimensionHrefsWithDefault);
            }

            if (DimensionLocatorsHrefs != null)
            {
                ret.DimensionLocatorsHrefs = new List<string>(DimensionLocatorsHrefs);
            }

            if (MeasureLocatorsHrefs != null)
            {
                ret.MeasureLocatorsHrefs = new List<string>(MeasureLocatorsHrefs);
            }

            if (RequiresElementRelationshipHrefs != null)
            {
                ret.RequiresElementRelationshipHrefs = new List<string>(RequiresElementRelationshipHrefs);
            }

            if (segmentHypercubesHRef != null)
            {
                ret.segmentHypercubesHRef = new List<string>(segmentHypercubesHRef);
            }

            if (scenarioHypercubesHref != null)
            {
                ret.scenarioHypercubesHref = new List<string>(scenarioHypercubesHref);
            }

            if (this.locators != null)
            {
                ret.locators = new Hashtable();

                foreach (DictionaryEntry de in this.locators)
                {
                    DefinitionLocator dl = de.Value as DefinitionLocator;

                    DefinitionLocator copy = dl.CreateCopyForMerging();

                }

                //using the parentnewvalue list we need to reset the parent infotrmationin
                //definition locators
                foreach (DefinitionLocator dl in ret.locators.Values)
                {
                    dl.ResetParentInformation(ret.locators);
                }
            }

            return ret;
        }
Example #2
0
        public void Append( DefinitionLink arg, ArrayList errors )
        {
            Hashtable tempLocators = new Hashtable();
            if ( arg.locators != null && arg.locators.Count > 0 )
            {
                foreach( DictionaryEntry de in arg.locators )
                {
                    DefinitionLocator loc
                        = locators[de.Key] as DefinitionLocator;
                    if ( loc != null )
                    {
                        tempLocators[de.Key] = de.Value;
                    }
                    else
                    {

                        locators[de.Key] = de.Value;
                    }

                }
            }

            // fix up the new locators
            foreach( DictionaryEntry de in tempLocators )
            {
                DefinitionLocator loc = locators[de.Key] as DefinitionLocator;
                DefinitionLocator oldLocator = de.Value as DefinitionLocator;

                loc.Append( oldLocator );

            }

            MergeStringList(HypercubeLocatorsHrefs, arg.HypercubeLocatorsHrefs);
            MergeStringList(NotAllRelationshipHypercubes, arg.NotAllRelationshipHypercubes);
            MergeStringList(DimensionHrefsWithDefault, arg.DimensionHrefsWithDefault);
            MergeStringList(DimensionLocatorsHrefs, arg.DimensionLocatorsHrefs);
            MergeStringList(MeasureLocatorsHrefs, arg.MeasureLocatorsHrefs);
            MergeStringList(RequiresElementRelationshipHrefs, arg.RequiresElementRelationshipHrefs);
            MergeStringList(scenarioHypercubesHref, arg.scenarioHypercubesHref);
            MergeStringList(segmentHypercubesHRef, arg.segmentHypercubesHRef);

            //preserve the old BaseSchema, so roleRef href will point to the correct schema
            BaseSchema = arg.BaseSchema;
        }
Example #3
0
        internal DimensionNode CreateDimensionNode(string lang, string role,
			Node parentNode, string parentId , DefinitionLink dLink, bool recursive, Hashtable definisionLinks,
			DefinitionLocatorRelationshipInfo lri, DimensionNode newNode, bool buildHypercubeChildren, bool isScenarioMarkup)
        {
            if (e == null) return null;

            if (newNode == null)
            {
                newNode = new DimensionNode(e);
                newNode.IsSegmentMarkup = !isScenarioMarkup;
                newNode.SetLabel(lang, role);
                newNode.NodeDimensionInfo = lri;
                newNode.IsDraggable = false;
                if (lri != null && lri.NodeType == DimensionNode.NodeType.Item && lri.Usable )
                {

                    if (!e.IsAbstract)
                    {
                        newNode.IsDraggable = true;
                    }
                }

                newNode.MyDefinitionLink = dLink;
            }

            if (lri != null)
            {
                newNode.SetOrder(lri.Order);

                if (PresentationLocator.preferredLabelRole.Equals(role))
                {
                    if (lri.PrefLabel != null)
                    {
                        newNode.UpdatePreferredLabel(lang, lri.PrefLabel);
                    }
                }
            }

            if (parentNode != null)
            {
                // and add it
                parentNode.AddChild(newNode);
                parentId = parentNode.Id;
            }

            if (recursive)
            {

                if (lri != null && lri.TargetRole != null && dLink.Role != lri.TargetRole)
                {
                    if (definisionLinks != null)
                    {
                        DefinitionLink targetDLink = definisionLinks[lri.TargetRole] as DefinitionLink;

                        if (targetDLink != null)
                        {
                            DefinitionLocator targetLocator;
                            if (targetDLink.TryGetLocator(newNode.Id, out targetLocator))
                            {

                                CreateChildNodes(lang, role, newNode,
                                    targetDLink, definisionLinks,
                                    targetLocator.childLocatorsByHRef, buildHypercubeChildren, isScenarioMarkup);
                            }

                        }

                    }
                    if (newNode.Children != null)
                    {
                        newNode.Children.Sort(new NodeOrderSorter());
                    }
                    return newNode;

                }

                CreateChildNodes(lang, role, newNode, dLink, definisionLinks, childLocatorsByHRef, buildHypercubeChildren, isScenarioMarkup);

                //need to sort the nodes
                if (newNode.Children != null)
                {
                    newNode.Children.Sort(new NodeOrderSorter());
                }
            }

            return newNode;
        }
Example #4
0
        private void CreateChildNodes(string lang, string role,
			DimensionNode parentNode ,
			DefinitionLink dLink,  Hashtable definisionLinks,
			HybridDictionary ChildDefinitionLocatorsHD, bool buildHypercubeChildren, bool isScenarioMarkup)
        {
            if (ChildDefinitionLocatorsHD == null) return;

            if (!buildHypercubeChildren)
            {
                if (parentNode.NodeDimensionInfo != null &&
                    parentNode.NodeDimensionInfo.NodeType == DimensionNode.NodeType.Hypercube)
                {
                    //no need to build the children...
                    return;
                }
            }
            foreach (ChildDefinitionLocator cdl in ChildDefinitionLocatorsHD.Values)
            {

                DefinitionLocator childLocator;
                if (!dLink.TryGetLocator(cdl.HRef, out childLocator))
                {
                    continue;
                }

                bool recursive = true;
                if (parentNode != null && parentNode.GetParent(childLocator.HRef) != null)
                {
                    recursive = false; //we have a recursion..
                    //this might be ok if one of the links is a prohibitted link...

                }

                //organize locators by non xlink attributes
                //we should have only one valid LocatorRelationshipInfo for each order...
                DefinitionLocatorRelationshipInfo currentRelationShip=null;

                for (int i = cdl.LocatorRelationshipInfos.Count - 1; i >= 0; i--)
                {
                    DefinitionLocatorRelationshipInfo lri = cdl.LocatorRelationshipInfos[i] as DefinitionLocatorRelationshipInfo;
                    if (currentRelationShip != null && lri.IsNonXlinkEquivalentRelationship(currentRelationShip)) continue;
                    currentRelationShip = lri;

                    //if (lri.IsDefault) continue; //this is just the default definition...no need to include it when we build the tree..
                    if ( lri.IsProhibited)
                        continue;

                    childLocator.CreateDimensionNode(lang, role,
                         parentNode, parentNode.Id, dLink, recursive, definisionLinks, lri, null, buildHypercubeChildren, isScenarioMarkup );

                }

            }
        }
Example #5
0
        private void ProcessDimensionLinks(XmlNode dlNode,
			string role, string title, ref int errorsEncountered, 
			Dictionary<string, string> discoveredSchemas)
        {
            DefinitionLink dl = definitionLinks[role] as DefinitionLink;

            if (dl == null)
            {
                // create the object
                dl = new DefinitionLink(title, role, BaseSchema, errorList);

                // put it in the hashtable
                definitionLinks[role] = dl;
            }

            // and load up the links
            int linkErrors = 0;
            dl.LoadChildren(dlNode, theManager,  discoveredSchemas, this.schemaPath, out linkErrors);

            errorsEncountered += linkErrors;
        }