Beispiel #1
0
        private static void AddAddendums(
            IDictionary <FilterSpecCompiled, FilterValueSetParam[][]> addendums,
            IList <FilterValueSetParam> addendumFilters,
            FilterSpecCompiled filtersSpec,
            FilterValueSetParam[][] optionalPartitionFilters)
        {
            FilterValueSetParam[][] params2Dim = new FilterValueSetParam[1][];
            params2Dim[0] = addendumFilters.ToArray();

            FilterValueSetParam[][] addendum;
            FilterValueSetParam[][] existing = addendums.Get(filtersSpec);
            if (existing != null)
            {
                addendum = ContextControllerAddendumUtil.MultiplyAddendum(existing, params2Dim);
            }
            else
            {
                addendum = params2Dim;
            }

            if (optionalPartitionFilters != null)
            {
                addendum = ContextControllerAddendumUtil.MultiplyAddendum(addendum, optionalPartitionFilters);
            }

            addendums[filtersSpec] = addendum;
        }
Beispiel #2
0
        /// <summary>
        /// Compare filters in statement with filters in segmented context, addendum filter compilation
        /// </summary>
        public static void GetAddendumFilters(IDictionary <FilterSpecCompiled, FilterValueSetParam[][]> addendums, int hashCode, IList <FilterSpecCompiled> filtersSpecs, ContextDetailHash hashSpec, ContextControllerStatementDesc statementDesc)
        {
            foreach (var filtersSpec in filtersSpecs)
            {
                var addendum = GetAddendumFilters(filtersSpec, hashCode, hashSpec, statementDesc);
                if (addendum == null)
                {
                    continue;
                }

                var existing = addendums.Get(filtersSpec);
                if (existing != null)
                {
                    addendum = ContextControllerAddendumUtil.MultiplyAddendum(existing, addendum);
                }
                addendums.Put(filtersSpec, addendum);
            }
        }
        private static void AddAddendums(
            IDictionary <FilterSpecCompiled, FilterValueSetParam[][]> addendums,
            FilterSpecCompiled filtersSpec,
            ContextDetailCategoryItem category,
            ContextDetailCategory categorySpec)
        {
            FilterValueSetParam[][] categoryEventFilters = categorySpec.FilterParamsCompiled;
            FilterValueSetParam[][] categoryItemFilters  = category.CompiledFilterParam;

            FilterValueSetParam[][] addendum = ContextControllerAddendumUtil.MultiplyAddendum(categoryEventFilters, categoryItemFilters);

            FilterValueSetParam[][] existingFilters = addendums.Get(filtersSpec);
            if (existingFilters != null)
            {
                addendum = ContextControllerAddendumUtil.MultiplyAddendum(existingFilters, addendum);
            }

            addendums[filtersSpec] = addendum;
        }
Beispiel #4
0
        // Compare filters in statement with filters in segmented context, addendum filter compilation
        public static void PopulateAddendumFilters(
            object keyValue,
            IList <FilterSpecCompiled> filtersSpecs,
            ContextDetailPartitioned segmentedSpec,
            StatementSpecCompiled optionalStatementSpecCompiled,
            IDictionary <FilterSpecCompiled, FilterValueSetParam[][]> addendums)
        {
            foreach (var filtersSpec in filtersSpecs)
            {
                var addendum = GetAddendumFilters(keyValue, filtersSpec, segmentedSpec, optionalStatementSpecCompiled);
                if (addendum == null)
                {
                    continue;
                }

                var existing = addendums.Get(filtersSpec);
                if (existing != null)
                {
                    addendum = ContextControllerAddendumUtil.MultiplyAddendum(existing, addendum);
                }
                addendums.Put(filtersSpec, addendum);
            }
        }
Beispiel #5
0
        // Compare filters in statement with filters in segmented context, addendum filter compilation
        /// <summary>
        /// Gets the addendum filters.
        /// </summary>
        /// <param name="addendums">The addendums.</param>
        /// <param name="agentInstanceId">The agent instance identifier.</param>
        /// <param name="filtersSpecs">The filters specs.</param>
        /// <param name="hashSpec">The hash spec.</param>
        /// <param name="statementDesc">The statement desc.</param>
        private static void GetAddendumFilters(
            IDictionary <FilterSpecCompiled, FilterValueSetParam[][]> addendums,
            int agentInstanceId,
            IList <FilterSpecCompiled> filtersSpecs,
            ContextDetailHash hashSpec,
            ContextControllerStatementDesc statementDesc)
        {
            // determine whether create-named-window
            var isCreateWindow = statementDesc != null && statementDesc.Statement.StatementSpec.CreateWindowDesc != null;

            if (!isCreateWindow)
            {
                foreach (var filtersSpec in filtersSpecs)
                {
                    var foundPartition = FindHashItemSpec(hashSpec, filtersSpec);
                    if (foundPartition == null)
                    {
                        continue;
                    }

                    FilterValueSetParam filter = new FilterValueSetParamImpl(foundPartition.Lookupable, FilterOperator.EQUAL, agentInstanceId);

                    var addendum = new FilterValueSetParam[1][];
                    addendum[0] = new FilterValueSetParam[] { filter };

                    var partitionFilters = foundPartition.ParametersCompiled;
                    if (partitionFilters != null)
                    {
                        addendum = ContextControllerAddendumUtil.AddAddendum(partitionFilters, filter);
                    }

                    FilterValueSetParam[][] existing = addendums.Get(filtersSpec);
                    if (existing != null)
                    {
                        addendum = ContextControllerAddendumUtil.MultiplyAddendum(existing, addendum);
                    }

                    addendums[filtersSpec] = addendum;
                }
            }
            // handle segmented context for create-window
            else
            {
                var declaredAsName = statementDesc.Statement.StatementSpec.CreateWindowDesc.AsEventTypeName;
                if (declaredAsName != null)
                {
                    foreach (var filterSpec in filtersSpecs)
                    {
                        ContextDetailHashItem foundPartition = null;
                        foreach (var partitionItem in hashSpec.Items)
                        {
                            if (partitionItem.FilterSpecCompiled.FilterForEventType.Name.Equals(declaredAsName))
                            {
                                foundPartition = partitionItem;
                                break;
                            }
                        }

                        if (foundPartition == null)
                        {
                            continue;
                        }

                        FilterValueSetParam filter = new FilterValueSetParamImpl(foundPartition.Lookupable, FilterOperator.EQUAL, agentInstanceId);

                        var addendum = new FilterValueSetParam[1][];
                        addendum[0] = new FilterValueSetParam[] { filter };

                        var existing = addendums.Get(filterSpec);
                        if (existing != null)
                        {
                            addendum = ContextControllerAddendumUtil.MultiplyAddendum(existing, addendum);
                        }

                        addendums[filterSpec] = addendum;
                    }
                }
            }
        }