Example #1
0
        /// <summary>
        ///     Either provides the requested namespace or creates it if it cannot be found
        ///     This method can create many levels of nested namespaces
        /// </summary>
        /// <param name="levels">The name of the namespace, with the levels separated into separate Strings</param>
        /// <param name="initialDictionary">The dictionary the namespace structure is being copied form</param>
        /// <returns></returns>
        public Types.NameSpace GetNameSpaceUpdate(String[] levels, Dictionary initialDictionary)
        {
            Types.NameSpace retVal = null;

            if (levels.Length > 0)
            {
                retVal = FindNameSpace(levels[0]);
                Types.NameSpace initialNameSpace = initialDictionary.FindNameSpace(levels[0]);

                if (retVal == null)
                {
                    retVal = (Types.NameSpace)acceptor.getFactory().createNameSpace();
                    retVal.setName(levels[0]);
                    appendNameSpaces(retVal);

                    // set the updates link for the new namespace
                    retVal.setUpdates(initialNameSpace.Guid);
                }

                for (int index = 1; index < levels.Length; index++)
                {
                    initialNameSpace = initialNameSpace.findNameSpaceByName((levels[index]));
                    retVal           = retVal.FindOrCreateNameSpaceUpdate(levels[index], initialNameSpace);
                }
            }

            return(retVal);
        }
        /// <summary>
        ///     Either provides the requested namespace or creates it if it cannot be found
        ///     This method can create many levels of nested namespaces
        /// </summary>
        /// <param name="levels">The name of the namespace, with the levels separated into separate Strings</param>
        /// <param name="initialDictionary">The dictionary the namespace structure is being copied form</param>
        /// <returns></returns>
        public Types.NameSpace GetNameSpaceUpdate(String[] levels, Dictionary initialDictionary)
        {
            Types.NameSpace retVal = null;

            if (levels.Length > 0)
            {
                retVal = FindNameSpace(levels[0]);
                Types.NameSpace initialNameSpace = initialDictionary.FindNameSpace(levels[0]);

                if (retVal == null)
                {
                    retVal = (Types.NameSpace) acceptor.getFactory().createNameSpace();
                    retVal.setName(levels[0]);
                    appendNameSpaces(retVal);

                    // set the updates link for the new namespace
                    retVal.setUpdates(initialNameSpace.Guid);
                }

                for (int index = 1; index < levels.Length; index++)
                {
                    initialNameSpace = initialNameSpace.findNameSpaceByName((levels[index]));
                    retVal = retVal.FindOrCreateNameSpaceUpdate(levels[index], initialNameSpace);
                }
            }

            return retVal;
        }