public override void Deserialize(IntermediateFormatReader reader)
        {
            base.Deserialize(reader);
            reader.RegisterDeclaration(m_declaration);
            while (reader.NextMember())
            {
                switch (reader.CurrentMember.MemberName)
                {
                case MemberName.Grouping:
                    m_grouping = (RuntimeGroupingObj)reader.ReadRIFObject();
                    if (m_grouping != null)
                    {
                        m_grouping.SetOwner(this);
                    }
                    break;

                case MemberName.Expression:
                    m_expression = (RuntimeExpressionInfo)reader.ReadRIFObject();
                    break;

                case MemberName.HierarchyRoot:
                    m_hierarchyRoot = (RuntimeHierarchyObjReference)reader.ReadRIFObject();
                    break;

                case MemberName.HierarchyObjs:
                    m_hierarchyObjs = reader.ReadListOfRIFObjects <List <IReference <RuntimeHierarchyObj> > >();
                    break;

                default:
                    Global.Tracer.Assert(condition: false);
                    break;
                }
            }
        }
Beispiel #2
0
        internal override bool SortAndFilter(AggregateUpdateContext aggContext)
        {
            if (m_odpContext.HasSecondPassOperation(SecondPassOperations.FilteringOrAggregatesOrDomainScope))
            {
                CopyDomainScopeGroupInstancesFromTarget();
            }
            RuntimeGroupingObj grouping = m_grouping;
            bool ascending = DetermineTraversalDirection();
            bool result    = true;
            bool processSecondPassSorting = ProcessSecondPassSorting;
            bool flag = (SecondPassOperations.FilteringOrAggregatesOrDomainScope & m_odpContext.SecondPassOperation) != 0 && (m_hierarchyDef.HasFilters || m_hierarchyDef.HasInnerFilters);

            if (processSecondPassSorting)
            {
                m_expression   = new RuntimeExpressionInfo(m_hierarchyDef.Sorting.SortExpressions, m_hierarchyDef.Sorting.ExprHost, m_hierarchyDef.Sorting.SortDirections, 0);
                m_groupingType = RuntimeGroupingObj.GroupingTypes.Sort;
                m_grouping     = new RuntimeGroupingObjTree(this, m_objectType);
            }
            else if (flag)
            {
                m_groupingType = RuntimeGroupingObj.GroupingTypes.None;
                m_grouping     = new RuntimeGroupingObjLinkedList(this, m_objectType);
            }
            if (flag)
            {
                m_groupFilters = new Filters(Filters.FilterTypes.GroupFilter, (IReference <Microsoft.ReportingServices.ReportProcessing.ReportProcessing.IFilterOwner>)base.SelfReference, m_hierarchyDef.Grouping.Filters, Microsoft.ReportingServices.ReportProcessing.ObjectType.Grouping, m_hierarchyDef.Grouping.Name, m_odpContext, base.Depth + 1);
            }
            m_processingStage = ProcessingStages.SortAndFilter;
            m_lastChild       = null;
            grouping.Traverse(ProcessingStages.SortAndFilter, ascending, aggContext);
            if (flag)
            {
                m_groupFilters.FinishReadingGroups(aggContext);
                if (!processSecondPassSorting && null == m_lastChild)
                {
                    if (m_firstChild != null)
                    {
                        m_firstChild.Free();
                    }
                    m_firstChild = null;
                    result       = false;
                }
            }
            if (grouping != m_grouping)
            {
                grouping.Cleanup();
            }
            return(result);
        }
 private void ConstructorHelper(int exprIndex, RuntimeHierarchyObjReference hierarchyRoot)
 {
     m_hierarchyRoot = hierarchyRoot;
     using (m_hierarchyRoot.PinValue())
     {
         RuntimeGroupRootObj runtimeGroupRootObj = m_hierarchyRoot.Value() as RuntimeGroupRootObj;
         Global.Tracer.Assert(runtimeGroupRootObj != null, "(null != groupRoot)");
         List <Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo> list;
         IndexedExprHost expressionsHost;
         List <bool>     directions;
         if (ProcessingStages.Grouping == runtimeGroupRootObj.ProcessingStage)
         {
             list            = runtimeGroupRootObj.GroupExpressions;
             expressionsHost = runtimeGroupRootObj.GroupExpressionHost;
             directions      = runtimeGroupRootObj.GroupDirections;
         }
         else
         {
             Global.Tracer.Assert(ProcessingStages.SortAndFilter == runtimeGroupRootObj.ProcessingStage, "(ProcessingStages.SortAndFilter == groupRoot.ProcessingStage)");
             list            = runtimeGroupRootObj.SortExpressions;
             expressionsHost = runtimeGroupRootObj.SortExpressionHost;
             directions      = runtimeGroupRootObj.SortDirections;
         }
         if (exprIndex == -1 || exprIndex >= list.Count)
         {
             m_hierarchyObjs = new List <IReference <RuntimeHierarchyObj> >();
             RuntimeGroupLeafObjReference runtimeGroupLeafObjReference = null;
             _ = m_odpContext.TablixProcessingScalabilityCache;
             if (ProcessingStages.Grouping == runtimeGroupRootObj.ProcessingStage)
             {
                 runtimeGroupLeafObjReference = runtimeGroupRootObj.CreateGroupLeaf();
                 if (!runtimeGroupRootObj.HasParent)
                 {
                     runtimeGroupRootObj.AddChildWithNoParent(runtimeGroupLeafObjReference);
                 }
             }
             if (null != runtimeGroupLeafObjReference)
             {
                 m_hierarchyObjs.Add(runtimeGroupLeafObjReference);
             }
         }
         else
         {
             m_expression = new RuntimeExpressionInfo(list, expressionsHost, directions, exprIndex);
             m_grouping   = RuntimeGroupingObj.CreateGroupingObj(runtimeGroupRootObj.GroupingType, this, m_objectType);
         }
     }
 }
Beispiel #4
0
 protected RuntimeGroupRootObj(IReference <IScope> outerScope, Microsoft.ReportingServices.ReportIntermediateFormat.ReportHierarchyNode hierarchyDef, DataActions dataAction, OnDemandProcessingContext odpContext, Microsoft.ReportingServices.ReportProcessing.ObjectType objectType)
     : base(odpContext, objectType, outerScope.Value().Depth + 1)
 {
     m_hierarchyRoot = (RuntimeHierarchyObjReference)m_selfReference;
     m_outerScope    = outerScope;
     m_hierarchyDef  = hierarchyDef;
     Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping = hierarchyDef.Grouping;
     Global.Tracer.Assert(grouping != null, "(null != groupDef)");
     m_isDetailGroup = grouping.IsDetail;
     if (m_isDetailGroup)
     {
         m_expression = null;
     }
     else
     {
         m_expression = new RuntimeExpressionInfo(grouping.GroupExpressions, grouping.ExprHost, grouping.SortDirections, 0);
     }
     if (m_odpContext.RuntimeSortFilterInfo != null)
     {
         int count = m_odpContext.RuntimeSortFilterInfo.Count;
         using (outerScope.PinValue())
         {
             IScope scope = outerScope.Value();
             for (int i = 0; i < count; i++)
             {
                 IReference <RuntimeSortFilterEventInfo> reference = m_odpContext.RuntimeSortFilterInfo[i];
                 using (reference.PinValue())
                 {
                     RuntimeSortFilterEventInfo runtimeSortFilterEventInfo = reference.Value();
                     if (runtimeSortFilterEventInfo.EventSource.ContainingScopes != null && runtimeSortFilterEventInfo.EventSource.ContainingScopes.Count != 0 && !runtimeSortFilterEventInfo.HasEventSourceScope && (!m_isDetailGroup || !runtimeSortFilterEventInfo.EventSource.IsSubReportTopLevelScope))
                     {
                         continue;
                     }
                     bool flag = false;
                     if (m_isDetailGroup)
                     {
                         if (!scope.TargetForNonDetailSort && IsTargetForSort(i, detailSort: true) && runtimeSortFilterEventInfo.EventTarget != base.SelfReference && scope.TargetScopeMatched(i, detailSort: true))
                         {
                             flag = true;
                             if (m_detailUserSortTargetInfo == null)
                             {
                                 m_detailUserSortTargetInfo = new RuntimeUserSortTargetInfo((IReference <IHierarchyObj>)base.SelfReference, i, reference);
                             }
                             else
                             {
                                 m_detailUserSortTargetInfo.AddSortInfo((IReference <IHierarchyObj>)base.SelfReference, i, reference);
                             }
                         }
                     }
                     else if (grouping.IsSortFilterExpressionScope != null)
                     {
                         flag = (grouping.IsSortFilterExpressionScope[i] && m_odpContext.UserSortFilterContext.InProcessUserSortPhase(i) && TargetScopeMatched(i, detailSort: false));
                     }
                     if (flag)
                     {
                         if (m_builtinSortOverridden == null)
                         {
                             m_builtinSortOverridden = new bool[count];
                         }
                         m_builtinSortOverridden[i] = true;
                     }
                 }
             }
         }
     }
     if (m_detailUserSortTargetInfo != null)
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.DetailUserSort;
     }
     else if (grouping.GroupAndSort && !BuiltinSortOverridden)
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.Sort;
     }
     else if (grouping.IsDetail && grouping.Parent == null && !BuiltinSortOverridden)
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.Detail;
     }
     else if (grouping.NaturalGroup)
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.NaturalGroup;
     }
     else
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.Hash;
     }
     m_grouping = RuntimeGroupingObj.CreateGroupingObj(m_groupingType, this, objectType);
     if (grouping.Filters == null)
     {
         m_dataAction      = dataAction;
         m_outerDataAction = dataAction;
     }
     if (grouping.RecursiveAggregates != null)
     {
         m_dataAction |= DataActions.RecursiveAggregates;
     }
     if (grouping.PostSortAggregates != null)
     {
         m_dataAction |= DataActions.PostSortAggregates;
     }
     if (grouping.Parent != null)
     {
         m_parentExpression = new RuntimeExpressionInfo(grouping.Parent, grouping.ParentExprHost, null, 0);
     }
 }