Beispiel #1
0
        /// <summary>
        /// Helper function to recursively extract the queries stored in a job query
        /// container and add them to a list.
        /// </summary>
        /// <param name="container">The container in which the queries are stored</param>
        /// <param name="prefix">
        /// A "prefix" string to prepend to the query names before they're inserted into
        /// the list
        /// </param>
        /// <param name="queryList">
        /// A sorted list into which the extracted queries will be added.  This function
        /// is intended to be called recursively in the case of job queries contained
        /// within subcontainers, so the list is *not* cleared by the function.
        /// </param>
        private static void AddQueriesFromContainer(
            IJTXJobQueryContainer container,
            string prefix,
            SortedList <string, string> queryList)
        {
            // Add the queries from the container at the current level
            IJTXJobQuerySet querySet = container.Queries;

            for (int i = 0; i < querySet.Count; i++)
            {
                IJTXJobQuery query = querySet.get_Item(i) as IJTXJobQuery;
                queryList.Add(prefix + query.Name, null);
            }

            // Iterate through each of the subcontainers and add them as well
            IJTXJobQueryContainerSet subcontainers = container.SubContainers;

            for (int i = 0; i < subcontainers.Count; i++)
            {
                IJTXJobQueryContainer tempContainer = subcontainers.get_Item(i);
                WmauGpDomainBuilder.AddQueriesFromContainer(
                    tempContainer,
                    prefix + tempContainer.Name + Properties.Resources.CONST_JOB_QUERY_SEP,
                    queryList);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Builds a domain consisting of the available job queries in the system.
        /// </summary>
        /// <param name="wmxDb">A reference to the active Workflow Manager database</param>
        /// <returns>A coded value domain as an IGPDomain</returns>
        public static IGPDomain BuildJobQueryDomain(IJTXDatabase3 wmxDb)
        {
            IGPCodedValueDomain domain = new GPCodedValueDomainClass();

            IJTXConfiguration3    configMgr = wmxDb.ConfigurationManager as IJTXConfiguration3;
            IJTXJobQueryContainer publicQueriesContainer = configMgr.GetPublicQueryContainer();

            // Sort the queries first
            SortedList <string, string> sortedValues = new SortedList <string, string>();

            WmauGpDomainBuilder.AddQueriesFromContainer(publicQueriesContainer, string.Empty, sortedValues);

            // Add the sorted types to the domain
            foreach (string value in sortedValues.Keys)
            {
                domain.AddStringCode(value, value);
            }

            return(domain as IGPDomain);
        }