Exemple #1
0
        private bool HasRelationshipOrDefaultForDataSet(ScopeTree scopeTree, ErrorContext errorContext, IRIFReportDataScope currentScope, DataSet ourDataSet, DataSet parentDataSet, bool hasValidRelationship)
        {
            if (DataSet.AreEqualById(parentDataSet, ourDataSet))
            {
                return(true);
            }
            if (!hasValidRelationship && !ourDataSet.HasDefaultRelationship(parentDataSet))
            {
                IntersectJoinInfo.RegisterInvalidCellDataSetNameError(scopeTree, errorContext, currentScope, ourDataSet, parentDataSet);
                return(false);
            }
            Relationship activeRelationship = base.GetActiveRelationship(ourDataSet, parentDataSet);

            if (activeRelationship == null)
            {
                IntersectJoinInfo.RegisterInvalidCellDataSetNameError(scopeTree, errorContext, currentScope, ourDataSet, parentDataSet);
                return(false);
            }
            if (activeRelationship.IsCrossJoin)
            {
                DataRegion parentDataRegion = scopeTree.GetParentDataRegion(currentScope);
                errorContext.Register(ProcessingErrorCode.rsInvalidIntersectionNaturalCrossJoin, Severity.Error, currentScope.DataScopeObjectType, parentDataRegion.Name, "JoinConditions", parentDataRegion.ObjectType.ToString());
                return(false);
            }
            return(true);
        }
        public override void AddMappedFieldIndices(List <int> parentFieldIndices, DataSet parentDataSet, DataSet ourDataSet, List <int> ourFieldIndices)
        {
            Global.Tracer.Assert(DataSet.AreEqualById(this.m_parentDataSet, parentDataSet), "Invalid parent data set");
            Relationship activeRelationship = this.GetActiveRelationship(ourDataSet);

            JoinInfo.AddMappedFieldIndices(activeRelationship, parentFieldIndices, ourFieldIndices);
        }
Exemple #3
0
 public override bool ValidateRelationships(ScopeTree scopeTree, ErrorContext errorContext, DataSet ourDataSet, ParentDataSetContainer parentDataSets, IRIFReportDataScope currentScope)
 {
     Global.Tracer.Assert(parentDataSets != null, "IntersectJoinInfo can only be used with one or two parent data sets");
     if (parentDataSets.Count == 1)
     {
         DataRegion parentDataRegion = scopeTree.GetParentDataRegion(currentScope);
         errorContext.Register(ProcessingErrorCode.rsUnexpectedCellDataSetName, Severity.Error, currentScope.DataScopeObjectType, parentDataRegion.Name, "DataSetName", parentDataRegion.ObjectType.ToString());
         return(false);
     }
     if (parentDataSets.AreAllSameDataSet() && DataSet.AreEqualById(parentDataSets.RowParentDataSet, ourDataSet))
     {
         return(false);
     }
     this.m_rowParentDataSet    = parentDataSets.RowParentDataSet;
     this.m_columnParentDataSet = parentDataSets.ColumnParentDataSet;
     if (this.m_rowParentDataSet != null && this.m_columnParentDataSet != null)
     {
         bool flag  = false;
         bool flag2 = false;
         if (base.m_relationships != null)
         {
             foreach (IdcRelationship relationship in base.m_relationships)
             {
                 if (!relationship.ValidateIntersectRelationship(errorContext, currentScope, scopeTree))
                 {
                     return(false);
                 }
                 this.CheckRelationshipDataSetBinding(scopeTree, errorContext, currentScope, relationship, this.m_rowParentDataSet, ref flag);
                 this.CheckRelationshipDataSetBinding(scopeTree, errorContext, currentScope, relationship, this.m_columnParentDataSet, ref flag2);
             }
         }
         flag  = this.HasRelationshipOrDefaultForDataSet(scopeTree, errorContext, currentScope, ourDataSet, this.m_rowParentDataSet, flag);
         flag2 = this.HasRelationshipOrDefaultForDataSet(scopeTree, errorContext, currentScope, ourDataSet, this.m_columnParentDataSet, flag2);
         if (flag && flag2)
         {
             DataRegion parentDataRegion2 = scopeTree.GetParentDataRegion(currentScope);
             if (this.ValidateCellBoundTotheSameDataSetAsParentScpoe(this.m_columnParentDataSet, this.m_rowParentDataSet, ourDataSet, parentDataRegion2.IsColumnGroupingSwitched))
             {
                 IRIFDataScope parentDataRegion3                = scopeTree.GetParentDataRegion(currentScope);
                 IRIFDataScope parentRowScopeForIntersection    = scopeTree.GetParentRowScopeForIntersection(currentScope);
                 IRIFDataScope parentColumnScopeForIntersection = scopeTree.GetParentColumnScopeForIntersection(currentScope);
                 if (parentDataRegion2.IsColumnGroupingSwitched)
                 {
                     errorContext.Register(ProcessingErrorCode.rsInvalidIntersectionNaturalJoin, Severity.Error, currentScope.DataScopeObjectType, parentDataRegion3.Name, "ParentScope", parentDataRegion3.DataScopeObjectType.ToString(), parentColumnScopeForIntersection.Name, parentRowScopeForIntersection.Name);
                     return(false);
                 }
                 errorContext.Register(ProcessingErrorCode.rsInvalidIntersectionNaturalJoin, Severity.Error, currentScope.DataScopeObjectType, parentDataRegion3.Name, "ParentScope", parentDataRegion3.DataScopeObjectType.ToString(), parentRowScopeForIntersection.Name, parentColumnScopeForIntersection.Name);
                 return(false);
             }
             return(true);
         }
         return(false);
     }
     return(false);
 }
Exemple #4
0
 private void CheckRelationshipDataSetBinding(ScopeTree scopeTree, ErrorContext errorContext, IRIFReportDataScope currentScope, IdcRelationship relationship, DataSet parentDataSetCandidate, ref bool dataSetAlreadyHasRelationship)
 {
     if (DataSet.AreEqualById(relationship.RelatedDataSet, parentDataSetCandidate))
     {
         if (dataSetAlreadyHasRelationship)
         {
             IRIFDataScope parentDataRegion = scopeTree.GetParentDataRegion(currentScope);
             IRIFDataScope parentRowScopeForIntersection    = scopeTree.GetParentRowScopeForIntersection(currentScope);
             IRIFDataScope parentColumnScopeForIntersection = scopeTree.GetParentColumnScopeForIntersection(currentScope);
             errorContext.Register(ProcessingErrorCode.rsInvalidRelationshipDuplicateParentScope, Severity.Error, currentScope.DataScopeObjectType, parentDataRegion.Name, "ParentScope", parentDataRegion.DataScopeObjectType.ToString(), parentRowScopeForIntersection.Name, parentColumnScopeForIntersection.Name);
         }
         dataSetAlreadyHasRelationship = true;
     }
 }
Exemple #5
0
 public static T FindActiveRelationship <T>(List <T> relationships, DataSet parentDataSet) where T : Relationship
 {
     if (relationships != null)
     {
         foreach (T relationship in relationships)
         {
             T current = relationship;
             if (DataSet.AreEqualById(current.RelatedDataSet, parentDataSet))
             {
                 return(current);
             }
         }
     }
     return(null);
 }
 private void AddGroupingFieldIndicesFromParentScope(InitializationContext context, IRIFDataScope parentScope)
 {
     Global.Tracer.Assert(parentScope.DataScopeInfo.GroupingFieldIndicesForServerAggregates != null, "Grouping fields for parent should have been captured first.");
     if (DataSet.AreEqualById(parentScope.DataScopeInfo.DataSet, this.m_dataSet))
     {
         this.m_groupingFieldIndicesForServerAggregates.AddRange(parentScope.DataScopeInfo.GroupingFieldIndicesForServerAggregates);
     }
     else if (this.m_joinInfo == null)
     {
         Global.Tracer.Assert(context.ErrorContext.HasError, "Missing expected error.");
     }
     else
     {
         this.m_joinInfo.AddMappedFieldIndices(parentScope.DataScopeInfo.GroupingFieldIndicesForServerAggregates, parentScope.DataScopeInfo.DataSet, this.m_dataSet, this.m_groupingFieldIndicesForServerAggregates);
     }
 }
Exemple #7
0
 private bool ValidateCellBoundTotheSameDataSetAsParentScpoe(DataSet columnParentDataSet, DataSet rowParentDataSet, DataSet ourDataSet, bool isColumnGroupingSwitched)
 {
     if (isColumnGroupingSwitched)
     {
         if (DataSet.AreEqualById(this.m_rowParentDataSet, ourDataSet))
         {
             return(this.GetActiveColumnRelationship(ourDataSet).NaturalJoin);
         }
         return(false);
     }
     if (DataSet.AreEqualById(this.m_columnParentDataSet, ourDataSet))
     {
         return(this.GetActiveRowRelationship(ourDataSet).NaturalJoin);
     }
     return(false);
 }
Exemple #8
0
        public override void AddMappedFieldIndices(List <int> parentFieldIndices, DataSet parentDataSet, DataSet ourDataSet, List <int> ourFieldIndices)
        {
            Relationship relationship;

            if (DataSet.AreEqualById(this.m_rowParentDataSet, parentDataSet))
            {
                relationship = this.GetActiveRowRelationship(ourDataSet);
            }
            else if (DataSet.AreEqualById(this.m_columnParentDataSet, parentDataSet))
            {
                relationship = this.GetActiveColumnRelationship(ourDataSet);
            }
            else
            {
                Global.Tracer.Assert(false, "Invalid parent data set");
                relationship = null;
            }
            JoinInfo.AddMappedFieldIndices(relationship, parentFieldIndices, ourFieldIndices);
        }
Exemple #9
0
 private void DetermineDataPipelineID(IRIFReportDataScope scope)
 {
     if (scope.DataScopeInfo.DataSet != null)
     {
         DataSet dataSet = scope.DataScopeInfo.DataSet;
         int     dataPipelineID;
         if (scope.DataScopeInfo.NeedsIDC)
         {
             if (base.m_tree.IsIntersectionScope(scope))
             {
                 if (DataSet.AreEqualById(dataSet, base.m_tree.GetParentRowScopeForIntersection(scope).DataScopeInfo.DataSet) || DataSet.AreEqualById(dataSet, base.m_tree.GetParentColumnScopeForIntersection(scope).DataScopeInfo.DataSet))
                 {
                     IRIFDataScope canonicalCellScope = base.m_tree.GetCanonicalCellScope(scope);
                     if (ScopeTree.SameScope(scope, canonicalCellScope))
                     {
                         dataPipelineID = this.m_nextDataPipelineId;
                         this.m_nextDataPipelineId++;
                     }
                     else
                     {
                         dataPipelineID = canonicalCellScope.DataScopeInfo.DataPipelineID;
                     }
                 }
                 else
                 {
                     dataPipelineID = dataSet.IndexInCollection;
                 }
             }
             else
             {
                 dataPipelineID = dataSet.IndexInCollection;
             }
         }
         else
         {
             IRIFDataScope iRIFDataScope = (!base.m_tree.IsIntersectionScope(scope)) ? base.m_tree.GetParentScope(scope) : base.m_tree.GetParentRowScopeForIntersection(scope);
             dataPipelineID = ((iRIFDataScope != null) ? iRIFDataScope.DataScopeInfo.DataPipelineID : dataSet.IndexInCollection);
         }
         scope.DataScopeInfo.DataPipelineID = dataPipelineID;
     }
 }
        public override bool ValidateRelationships(ScopeTree scopeTree, ErrorContext errorContext, DataSet ourDataSet, ParentDataSetContainer parentDataSets, IRIFReportDataScope currentScope)
        {
            Global.Tracer.Assert(parentDataSets != null && parentDataSets.Count == 1, "LinearJoinInfo can only be used with exactly one parent data set");
            this.m_parentDataSet = parentDataSets.ParentDataSet;
            if (DataSet.AreEqualById(ourDataSet, this.m_parentDataSet))
            {
                return(false);
            }
            bool flag = false;

            if (base.m_relationships != null)
            {
                foreach (IdcRelationship relationship in base.m_relationships)
                {
                    flag |= relationship.ValidateLinearRelationship(errorContext, this.m_parentDataSet);
                }
            }
            if (!flag && !ourDataSet.HasDefaultRelationship(this.m_parentDataSet))
            {
                this.RegisterInvalidInnerDataSetNameError(errorContext, ourDataSet, currentScope);
                return(false);
            }
            Relationship activeRelationship = this.GetActiveRelationship(ourDataSet);

            if (activeRelationship == null)
            {
                this.RegisterInvalidInnerDataSetNameError(errorContext, ourDataSet, currentScope);
                return(false);
            }
            if (activeRelationship.IsCrossJoin && (!activeRelationship.NaturalJoin || LinearJoinInfo.ScopeHasParentGroups(currentScope, scopeTree)))
            {
                errorContext.Register(ProcessingErrorCode.rsInvalidNaturalCrossJoin, Severity.Error, currentScope.DataScopeObjectType, currentScope.Name, "JoinConditions");
                return(false);
            }
            return(true);
        }
 public void ValidateDataSetBindingAndRelationships(ScopeTree scopeTree, IRIFReportDataScope scope, ErrorContext errorContext)
 {
     if (this.m_dataSet == null)
     {
         ParentDataSetContainer parentDataSetContainer = DataScopeInfo.DetermineParentDataSets(scopeTree, scope);
         if (this.m_dataSetName == null)
         {
             this.BindToParentDataSet(scopeTree, scope, errorContext, parentDataSetContainer);
         }
         else
         {
             this.BindToNamedDataSet(scopeTree, scope, errorContext, parentDataSetContainer);
         }
         if (this.m_dataSet != null)
         {
             if (scopeTree.GetParentDataRegion(scope) == null && this.m_joinInfo != null)
             {
                 errorContext.Register(ProcessingErrorCode.rsInvalidRelationshipTopLevelDataRegion, Severity.Error, scope.DataScopeObjectType, scope.Name, "Relationship");
                 this.m_joinInfo = null;
             }
             if (parentDataSetContainer != null && this.m_joinInfo == null)
             {
                 if (parentDataSetContainer.Count == 1)
                 {
                     this.m_joinInfo = new LinearJoinInfo();
                 }
                 else
                 {
                     this.m_joinInfo = new IntersectJoinInfo();
                 }
             }
             if (this.m_joinInfo != null)
             {
                 if (!this.m_joinInfo.ValidateRelationships(scopeTree, errorContext, this.m_dataSet, parentDataSetContainer, scope))
                 {
                     this.m_joinInfo = null;
                 }
                 if (this.m_joinInfo == null && this.m_dataSetName != null && this.m_dataSet != null && !DataSet.AreEqualById(parentDataSetContainer.ParentDataSet, this.m_dataSet))
                 {
                     this.UpdateDataSet(parentDataSetContainer.ParentDataSet, scope);
                 }
             }
         }
     }
 }