public PublishingContext(ICatalogItemContext catalogContext, byte[] reportDefinition, IChunkFactory createChunkFactory, AppDomain compilationTempAppDomain, bool generateExpressionHostWithRefusedPermissions, ReportProcessingFlags processingFlags, ReportProcessing.CheckSharedDataSource checkDataSourceCallback, ReportProcessing.ResolveTemporaryDataSource resolveTemporaryDataSourceCallback, DataSourceInfoCollection originalDataSources, ReportProcessing.CheckSharedDataSet checkDataSetCallback, ReportProcessing.ResolveTemporaryDataSet resolveTemporaryDataSetCallback, DataSetInfoCollection originalDataSets, IConfiguration configuration, IDataProtection dataProtection,
                          bool isInternalRepublish, bool isPackagedReportArchive, bool isRdlx)
     : base(PublishingContextKind.Full, catalogContext, createChunkFactory, compilationTempAppDomain, generateExpressionHostWithRefusedPermissions, processingFlags, checkDataSourceCallback, resolveTemporaryDataSourceCallback, originalDataSources, checkDataSetCallback, resolveTemporaryDataSetCallback, originalDataSets, configuration, dataProtection,
            isInternalRepublish, isPackagedReportArchive, isRdlx, false)
 {
     this.m_definition = reportDefinition;
 }
Exemple #2
0
        public static string BuildPathUri(ICatalogItemContext currentICatalogItemContext, bool checkProtocol, string initialUrl, NameValueCollection unparsedParameters, out ICatalogItemContext newContext)
        {
            newContext = null;
            if (currentICatalogItemContext == null)
            {
                return(initialUrl);
            }
            string text = null;

            try
            {
                text = currentICatalogItemContext.CombineUrl(initialUrl, checkProtocol, unparsedParameters, out newContext);
            }
            catch (RSException)
            {
                throw;
            }
            catch (Exception)
            {
                throw new RenderingObjectModelException(ErrorCode.rsMalformattedURL);
            }
            if (!currentICatalogItemContext.IsSupportedProtocol(text, checkProtocol))
            {
                throw new RenderingObjectModelException(ErrorCode.rsUnsupportedURLProtocol, text.MarkAsPrivate());
            }
            return(text);
        }
        public void SubReportCallback(ICatalogItemContext reportContext, string subreportPath, out ICatalogItemContext subreportContext, out string description, out ReportProcessing.GetReportChunk getCompiledDefinitionCallback, out ParameterInfoCollection parameters)
        {
            getCompiledDefinitionCallback = null;
            IChunkFactory chunkFactory = null;

            this.m_subreportCallback(reportContext, subreportPath, null, this.NeedsUpgrade, null, out subreportContext, out description, out chunkFactory, out parameters);
            if (chunkFactory != null)
            {
                if (ReportProcessing.ContainsFlag(chunkFactory.ReportProcessingFlags, ReportProcessingFlags.OnDemandEngine))
                {
                    subreportContext = null;
                    description      = null;
                    getCompiledDefinitionCallback = null;
                    parameters = null;
                    string text  = subreportPath.MarkAsPrivate();
                    string text2 = reportContext.ItemPathAsString.MarkAsPrivate();
                    Global.Tracer.Trace(TraceLevel.Warning, "The subreport '{0}' could not be processed.  Parent report '{1}' failed to automatically republish, or it contains a Reporting Services 2005-style CustomReportItem, and is therefore incompatible with the subreport. To correct this error, please attempt to republish the parent report manually. If it contains a CustomReportItem, please upgrade the report to the latest version.", text, text2);
                    if (this.m_errorContext != null)
                    {
                        this.m_errorContext.Register(ProcessingErrorCode.rsEngineMismatchParentReport, Severity.Warning, ObjectType.Subreport, text, null, text, text2);
                    }
                    throw new ReportProcessingException(ErrorCode.rsInvalidOperation, RPRes.rsEngineMismatchParentReport(ObjectType.Subreport.ToString(), subreportPath, null, subreportPath, reportContext.ItemPathAsString));
                }
                ChunkFactoryAdapter @object = new ChunkFactoryAdapter(chunkFactory);
                getCompiledDefinitionCallback = @object.GetReportChunk;
                return;
            }
            if (subreportContext != null)
            {
                return;
            }
            throw new ReportProcessingException(RPRes.rsMissingSubReport(subreportPath, subreportPath), ErrorCode.rsItemNotFound);
        }
Exemple #4
0
        public void GetResource(ICatalogItemContext reportContext, string imageUrl, out byte[] resource, out string mimeType, out bool registerWarning, out bool registerInvalidSizeWarning)
        {
            registerInvalidSizeWarning = false;
            ICatalogItemContext catalogItemContext = null;

            if (reportContext != null)
            {
                catalogItemContext = reportContext.Combine(imageUrl);
            }
            if (catalogItemContext != null)
            {
                resource        = m_catalog.GetResource(catalogItemContext.ItemPathAsString, out mimeType);
                registerWarning = (resource == null);
                return;
            }
            try
            {
                registerWarning = false;
                resource        = ExternalResourceLoader.GetExternalResource(imageUrl, impersonate: true, null, null, null, 600, ExternalResourceLoader.MaxResourceSizeUnlimited, null, out mimeType, out registerInvalidSizeWarning);
            }
            finally
            {
                registerWarning = true;
            }
        }
Exemple #5
0
        private Item GetCatalogItem(ICatalogItemContext data, Database database)
        {
            var id = GetCatalogItemFromCache(data.Id, data.Catalog);

            if (!ID.IsNullOrEmpty(id))
            {
                return(id == ID.Undefined ? null : database.GetItem(id));
            }

            Item item = null;

            switch (data.ItemType)
            {
            case CatalogItemType.Product:
                item = CatalogManager.GetProduct(data.Id, data.Catalog);
                break;

            case CatalogItemType.Category:
                item = CatalogManager.GetCategoryItem(data.Id, data.Catalog);
                break;
            }
            if (item != null)
            {
                AddCatalogItemToCache(data.Id, data.Catalog, item);
            }
            return(item);
        }
Exemple #6
0
        public static PublishingResult CompileReport(ICatalogItemContext context, byte[] reportDefinition, bool generateExpressionHostWithRefusedPermissions, out ControlSnapshot snapshot)
        {
            PublishingResult publishingResult = null;

            snapshot = null;

            try
            {
                ReportProcessing reportProcessing = new ReportProcessing();
                snapshot = new ControlSnapshot();
                AppDomain         appDomain = AppDomain.CurrentDomain;
                PublishingContext reportPublishingContext = new PublishingContext(context, reportDefinition, snapshot, appDomain, generateExpressionHostWithRefusedPermissions,
                                                                                  snapshot.ReportProcessingFlags, reportProcessing.Configuration, DataProtectionLocal.Instance);
                return(reportProcessing.CreateIntermediateFormat(reportPublishingContext));
            }
            catch (Exception inner)
            {
                string text = context.ItemPathAsString;
                if (text == null)
                {
                    text = ProcessingStrings.MainReport;
                }
                throw new DefinitionInvalidException(text, inner);
            }
        }
        public void SubReportDataSourcesCallback(ICatalogItemContext reportContext, string subreportPath, out ICatalogItemContext subreportContext, out ReportProcessing.GetReportChunk getCompiledDefinitionCallback, out DataSourceInfoCollection dataSources)
        {
            getCompiledDefinitionCallback = null;
            IChunkFactory getCompiledDefinitionCallback2 = null;

            m_subreportDataSourcesCallback(reportContext, subreportPath, NeedsUpgrade, out subreportContext, out getCompiledDefinitionCallback2, out dataSources, out DataSetInfoCollection _);
            if (getCompiledDefinitionCallback2 != null)
            {
                if (ReportProcessing.ContainsFlag(getCompiledDefinitionCallback2.ReportProcessingFlags, ReportProcessingFlags.OnDemandEngine))
                {
                    subreportContext = null;
                    getCompiledDefinitionCallback = null;
                    dataSources = null;
                    string text  = subreportPath.MarkAsPrivate();
                    string text2 = reportContext.ItemPathAsString.MarkAsPrivate();
                    Global.Tracer.Trace(TraceLevel.Warning, "The subreport '{0}' could not be processed.  Parent report '{1}' failed to automatically republish, or it contains a Reporting Services 2005-style CustomReportItem, and is therefore incompatible with the subreport. To correct this error, please attempt to republish the parent report manually. If it contains a CustomReportItem, please upgrade the report to the latest version.", text, text2);
                    throw new ReportProcessingException(ErrorCode.rsInvalidOperation, RPRes.rsEngineMismatchParentReport(ObjectType.Subreport.ToString(), text, null, text, text2));
                }
                ChunkFactoryAdapter @object = new ChunkFactoryAdapter(getCompiledDefinitionCallback2);
                getCompiledDefinitionCallback = @object.GetReportChunk;
            }
            else if (subreportContext == null)
            {
                throw new ReportProcessingException(RPRes.rsMissingSubReport(subreportPath, subreportPath), ErrorCode.rsItemNotFound);
            }
        }
        private DataSetPublishingResult GetCompiledDataSet(DataSetInfo dataSetInfo, ICatalogItemContext dataSetContext)
        {
            StoredDataSet storedDataSet = this.m_catalogTempDB.GetCompiledDataSet(dataSetInfo);

            if (storedDataSet != null && !storedDataSet.Definition.SequenceEqual(dataSetInfo.Definition))
            {
                storedDataSet = null;
            }
            if (storedDataSet == null)
            {
                DataSetPublishingResult result = default(DataSetPublishingResult);
                try
                {
                    using (ControlSnapshot createChunkFactory = new ControlSnapshot())
                    {
                        ReportProcessing  reportProcessing = this.CreateAndConfigureReportProcessing();
                        PublishingContext sharedDataSetPublishingContext = new PublishingContext(dataSetContext, dataSetInfo.Definition, createChunkFactory, AppDomain.CurrentDomain, true, this.GetDataSourceForSharedDataSetHandler, reportProcessing.Configuration);
                        result = reportProcessing.CreateSharedDataSet(sharedDataSetPublishingContext);
                    }
                }
                catch (Exception inner)
                {
                    throw new DefinitionInvalidException(dataSetInfo.AbsolutePath, inner);
                }
                storedDataSet = new StoredDataSet(dataSetInfo.Definition, result);
                this.m_catalogTempDB.SetCompiledDataSet(dataSetInfo, storedDataSet);
            }
            return(storedDataSet.PublishingResult);
        }
Exemple #9
0
 internal ReportProcessingContext(ICatalogItemContext reportContext, string requestUserName, ParameterInfoCollection parameters, RuntimeDataSourceInfoCollection dataSources, RuntimeDataSetInfoCollection sharedDataSetReferences, ReportProcessing.OnDemandSubReportCallback subReportCallback, IGetResource getResourceFunction, IChunkFactory createChunkFactory, ReportProcessing.ExecutionType interactiveExecution, CultureInfo culture, UserProfileState allowUserProfileState, UserProfileState initialUserProfileState, IProcessingDataExtensionConnection createDataExtensionInstanceFunction, ReportRuntimeSetup reportRuntimeSetup, CreateAndRegisterStream createStreamCallback, bool isHistorySnapshot, IJobContext jobContext, IExtensionFactory extFactory, IDataProtection dataProtection, ISharedDataSet dataSetExecute)
     : base(reportContext, requestUserName, parameters, subReportCallback, getResourceFunction, createChunkFactory, interactiveExecution, culture, allowUserProfileState, initialUserProfileState, reportRuntimeSetup, createStreamCallback, isHistorySnapshot, jobContext, extFactory, dataProtection)
 {
     m_dataSources                         = dataSources;
     m_sharedDataSetReferences             = sharedDataSetReferences;
     m_createDataExtensionInstanceFunction = createDataExtensionInstanceFunction;
     m_dataSetExecute                      = dataSetExecute;
 }
 internal ReportUrl(ICatalogItemContext itemContext, string initialUrl, bool checkProtocol, NameValueCollection unparsedParameters)
 {
     m_pathUri = new Uri(BuildPathUri(itemContext, checkProtocol, initialUrl, unparsedParameters, out ICatalogItemContext _));
     if (m_pathUri != null && string.CompareOrdinal(m_pathUri.Scheme, "mailto") == 0)
     {
         _ = m_pathUri.AbsoluteUri;
     }
 }
Exemple #11
0
        public string GetStreamUrl(bool useSessionId, string streamName)
        {
            ICatalogItemContext catalogItemContext = m_isOldSnapshot ? m_renderReport.RenderingContext.TopLevelReportContext : m_renderingContext.OdpContext.ReportContext;

            _ = catalogItemContext.HostSpecificItemPath;
            _ = catalogItemContext.HostRootUri;
            return(catalogItemContext.RSRequestParameters.GetImageUrl(useSessionId, streamName, catalogItemContext));
        }
Exemple #12
0
        internal ReportUrlBuilder(RenderingContext reportContext, string initialUrl, string replacementRoot)
        {
            ICatalogItemContext topLevelReportContext = reportContext.TopLevelReportContext;

            ReportUrl.BuildPathUri(topLevelReportContext, initialUrl, null, out ICatalogItemContext _);
            m_catalogItemUrlBuilder = new CatalogItemUrlBuilder(topLevelReportContext, topLevelReportContext.RSRequestParameters);
            m_replacementRoot       = replacementRoot;
        }
        public ReportUrlBuilder(RenderingContext reportContext, string initialUrl, string replacementRoot)
        {
            ICatalogItemContext topLevelReportContext = reportContext.TopLevelReportContext;
            ICatalogItemContext catalogItemContext    = default(ICatalogItemContext);

            ReportUrl.BuildPathUri(topLevelReportContext, initialUrl, (NameValueCollection)null, out catalogItemContext);
            this.m_catalogItemUrlBuilder = new CatalogItemUrlBuilder(topLevelReportContext, topLevelReportContext.RSRequestParameters);
            this.m_replacementRoot       = replacementRoot;
        }
Exemple #14
0
        public ReportUrl(ICatalogItemContext itemContext, string initialUrl, bool checkProtocol, NameValueCollection unparsedParameters)
        {
            ICatalogItemContext catalogItemContext = default(ICatalogItemContext);

            this.m_pathUri = new Uri(ReportUrl.BuildPathUri(itemContext, checkProtocol, initialUrl, unparsedParameters, out catalogItemContext));
            if (this.m_pathUri != (Uri)null && string.CompareOrdinal(this.m_pathUri.Scheme, "mailto") == 0)
            {
                string absoluteUri = this.m_pathUri.AbsoluteUri;
            }
        }
        private static string NormalizeRenderFormatForDocumentMap(ICatalogItemContext reportContext)
        {
            bool   isInteractiveFormat;
            string result = RenderFormatImpl.NormalizeRenderFormat(reportContext, out isInteractiveFormat);

            if (isInteractiveFormat)
            {
                result = "RPL";
            }
            return(result);
        }
Exemple #16
0
 public void Add(DataSetInfo dataSet, ICatalogItemContext report)
 {
     if (Guid.Empty == dataSet.ID)
     {
         this.AddToCollectionByReport(dataSet, report);
     }
     else
     {
         this.AddToCollectionByID(dataSet);
     }
 }
        private static string NormalizeRenderFormatForDocumentMap(ICatalogItemContext reportContext)
        {
            bool   flag   = default(bool);
            string result = RenderFormatImpl.NormalizeRenderFormat(reportContext, out flag);

            if (flag)
            {
                result = "RPL";
            }
            return(result);
        }
        internal static string BuildDrillthroughUrl(ICatalogItemContext currentCatalogItemContext, string initialUrl, NameValueCollection parameters)
        {
            if (BuildPathUri(currentCatalogItemContext, checkProtocol: true, initialUrl, parameters, out ICatalogItemContext newContext) == null || newContext == null)
            {
                return(null);
            }
            CatalogItemUrlBuilder catalogItemUrlBuilder = new CatalogItemUrlBuilder(newContext, newContext.RSRequestParameters);

            catalogItemUrlBuilder.AppendReportParameters(parameters);
            return(new Uri(catalogItemUrlBuilder.ToString()).AbsoluteUri);
        }
 internal bool CanUseExistingDocumentMapChunk(ICatalogItemContext reportContext)
 {
     if (!HasDocumentMap)
     {
         return(false);
     }
     if (!DocumentMapHasRenderFormatDependency)
     {
         return(true);
     }
     return(RenderFormatImpl.IsRenderFormat(NormalizeRenderFormatForDocumentMap(reportContext), m_documentMapRenderFormat));
 }
        private void OnGetSubReportDataSources(ICatalogItemContext itemContext, string subreportPath, ReportProcessing.NeedsUpgrade upgradeCheck, out ICatalogItemContext subreportContext, out IChunkFactory getCompiledDefinition, out DataSourceInfoCollection dataSources, out DataSetInfoCollection dataSets)
        {
            subreportPath    = this.NormalizeSubReportPath(subreportPath);
            subreportContext = itemContext.GetSubreportContext(subreportPath);
            RSTrace.ReportPreviewTracer.Trace(TraceLevel.Info, "Getting datasources information for {0}.", subreportContext.ItemPathAsString);
            ControlSnapshot  controlSnapshot = default(ControlSnapshot);
            PublishingResult compiledReport  = this.GetCompiledReport((PreviewItemContext)subreportContext, false, out controlSnapshot);

            getCompiledDefinition = controlSnapshot;
            dataSources           = this.ResolveSharedDataSources(compiledReport.DataSources);
            dataSets = this.ResolveSharedDataSets(compiledReport.SharedDataSets);
        }
Exemple #21
0
 public void Add(DataSourceInfo dataSource, ICatalogItemContext report)
 {
     if (Guid.Empty == dataSource.ID)
     {
         this.AddToCollectionByReport(dataSource, report);
     }
     else
     {
         this.AddToCollectionByID(dataSource);
     }
     this.CheckedAddByPrompt(dataSource);
 }
Exemple #22
0
 public DataSourceInfo GetByName(string name, ICatalogItemContext report)
 {
     if (this.m_collectionByReport != null)
     {
         DataSourceInfoCollection dataSourceInfoCollection = (DataSourceInfoCollection)this.m_collectionByReport[report.StableItemPath];
         if (dataSourceInfoCollection != null)
         {
             return(dataSourceInfoCollection.GetByOriginalName(name));
         }
     }
     return(null);
 }
 internal RenderingContext(ICatalogItemContext reportContext, string reportDescription, EventInformation eventInfo, ReportRuntimeSetup reportRuntimeSetup, ReportProcessing.StoreServerParameters storeServerParameters, UserProfileState allowUserProfileState, PaginationMode clientPaginationMode, int previousTotalPages)
 {
     Global.Tracer.Assert(reportContext != null, "(null != reportContext)");
     m_reportContext         = reportContext;
     m_reportDescription     = reportDescription;
     m_eventInfo             = eventInfo;
     m_storeServerParameters = storeServerParameters;
     m_allowUserProfileState = allowUserProfileState;
     m_reportRuntimeSetup    = reportRuntimeSetup;
     m_clientPaginationMode  = clientPaginationMode;
     m_previousTotalPages    = previousTotalPages;
 }
Exemple #24
0
        public static string BuildDrillthroughUrl(ICatalogItemContext currentCatalogItemContext, string initialUrl, NameValueCollection parameters)
        {
            ICatalogItemContext catalogItemContext = default(ICatalogItemContext);
            string text = ReportUrl.BuildPathUri(currentCatalogItemContext, true, initialUrl, parameters, out catalogItemContext);

            if (text != null && catalogItemContext != null)
            {
                CatalogItemUrlBuilder catalogItemUrlBuilder = new CatalogItemUrlBuilder(catalogItemContext, catalogItemContext.RSRequestParameters);
                catalogItemUrlBuilder.AppendReportParameters(parameters);
                Uri uri = new Uri(catalogItemUrlBuilder.ToString());
                return(uri.AbsoluteUri);
            }
            return(null);
        }
        private DataSourceInfoCollection CompileDataSetsAndCombineDataSources(DataSetInfoCollection dataSets, DataSourceInfoCollection existingDataSources)
        {
            DataSourceInfoCollection dataSourceInfoCollection = new DataSourceInfoCollection(existingDataSources);

            foreach (DataSetInfo dataSet in dataSets)
            {
                ICatalogItemContext     dataSetContext  = this.m_itemContext.GetDataSetContext(dataSet.AbsolutePath);
                DataSetPublishingResult compiledDataSet = this.GetCompiledDataSet(dataSet, dataSetContext);
                compiledDataSet.DataSourceInfo.OriginalName = compiledDataSet.DataSourceInfo.ID.ToString();
                dataSourceInfoCollection.Add(compiledDataSet.DataSourceInfo);
                dataSet.DataSourceId = compiledDataSet.DataSourceInfo.ID;
            }
            return(dataSourceInfoCollection);
        }
Exemple #26
0
        internal DataSetInfo GetByName(string name, ICatalogItemContext item)
        {
            DataSetInfo result = null;

            if (m_collectionByReport != null)
            {
                DataSetInfoCollection value = null;
                if (m_collectionByReport.TryGetValue(item.StableItemPath, out value))
                {
                    result = value.GetByName(name);
                }
            }
            return(result);
        }
Exemple #27
0
        public DataSetInfo GetByName(string name, ICatalogItemContext item)
        {
            DataSetInfo result = null;

            if (this.m_collectionByReport != null)
            {
                DataSetInfoCollection dataSetInfoCollection = null;
                if (this.m_collectionByReport.TryGetValue(item.StableItemPath, out dataSetInfoCollection))
                {
                    result = dataSetInfoCollection.GetByName(name);
                }
            }
            return(result);
        }
        public bool CanUseExistingDocumentMapChunk(ICatalogItemContext reportContext)
        {
            if (!this.HasDocumentMap)
            {
                return(false);
            }
            if (!this.DocumentMapHasRenderFormatDependency)
            {
                return(true);
            }
            string format = ReportSnapshot.NormalizeRenderFormatForDocumentMap(reportContext);

            return(RenderFormatImpl.IsRenderFormat(format, this.m_documentMapRenderFormat));
        }
Exemple #29
0
 internal RenderingContext(RenderingContext copy, string prefix)
 {
     m_commonInfo       = copy.m_commonInfo;
     m_inPageSection    = true;
     m_prefix           = prefix;
     m_eventInfo        = null;
     m_reportSnapshot   = null;
     m_processedItems   = null;
     m_cachedHiddenInfo = null;
     m_contextUri       = copy.m_contextUri;
     m_embeddedImages   = copy.EmbeddedImages;
     m_imageStreamNames = copy.ImageStreamNames;
     m_currentReportICatalogItemContext = m_commonInfo.TopLevelReportContext;
     m_jobContext     = copy.m_jobContext;
     m_dataProtection = copy.m_dataProtection;
 }
Exemple #30
0
 internal RenderingContext(RenderingContext copy, Uri contextUri, EmbeddedImageHashtable embeddedImages, ImageStreamNames imageStreamNames, ICatalogItemContext subreportICatalogItemContext)
 {
     m_commonInfo       = copy.m_commonInfo;
     m_inPageSection    = false;
     m_prefix           = null;
     m_eventInfo        = copy.m_eventInfo;
     m_reportSnapshot   = copy.ReportSnapshot;
     m_processedItems   = null;
     m_cachedHiddenInfo = copy.m_cachedHiddenInfo;
     m_contextUri       = contextUri;
     m_embeddedImages   = embeddedImages;
     m_imageStreamNames = imageStreamNames;
     m_currentReportICatalogItemContext = subreportICatalogItemContext;
     m_jobContext     = copy.m_jobContext;
     m_dataProtection = copy.m_dataProtection;
 }