public void SetReportParameters(NameValueCollection userSpecifiedValues) { ParameterInfoCollection parameterInfoCollection = this.m_executionSession.ExecutionInfo.ReportParameters; if (parameterInfoCollection == null) { ControlSnapshot controlSnapshot = default(ControlSnapshot); PublishingResult compiledReport = this.GetCompiledReport(this.m_itemContext, false, out controlSnapshot); parameterInfoCollection = compiledReport.Parameters; } else if (userSpecifiedValues == null) { return; } ParameterInfoCollection parameterInfoCollection2; if (userSpecifiedValues != null) { ParameterInfoCollection newParameters = ParameterInfoCollection.DecodeFromNameValueCollectionAndUserCulture(userSpecifiedValues); parameterInfoCollection2 = ParameterInfoCollection.Combine(parameterInfoCollection, newParameters, true, false, false, false, Localization.ClientPrimaryCulture); } else { parameterInfoCollection2 = parameterInfoCollection; } ParameterInfoCollection parameterInfoCollection3 = new ParameterInfoCollection(); parameterInfoCollection2.CopyTo(parameterInfoCollection3); this.ProcessAndStoreReportParameters(parameterInfoCollection3); }
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 PublishingResult CompileReport() { ControlSnapshot compiledReport = default(ControlSnapshot); PublishingResult compiledReport2 = this.GetCompiledReport(this.m_itemContext, true, out compiledReport); this.m_executionSession.CompiledReport = compiledReport; this.m_executionSession.ExecutionInfo.PageProperties = compiledReport2.PageProperties; this.m_executionSession.CompiledDataSources = compiledReport2.DataSources; return(compiledReport2); }
public PublishingResult CompileReport() { ControlSnapshot snapshot; PublishingResult compiledReport = GetCompiledReport(m_itemContext, rebuild: true, out snapshot); m_executionSession.CompiledReport = snapshot; m_executionSession.ExecutionInfo.PageProperties = compiledReport.PageProperties; m_executionSession.CompiledDataSources = compiledReport.DataSources; return(compiledReport); }
private void ValidateReportSecurity(PreviewItemContext itemContext, PublishingResult publishingResult) { if (publishingResult.HasExternalImages && !EnableExternalImages) { throw new ReportSecurityException(CommonStrings.ExternalImagesError(itemContext.ItemName)); } if (publishingResult.HasHyperlinks && !EnableHyperlinks) { throw new ReportSecurityException(CommonStrings.HyperlinkSecurityError(itemContext.ItemName)); } }
private PublishingResult GetCompiledReport(PreviewItemContext itemContext, bool rebuild, out ControlSnapshot snapshot) { StoredReport storedReport = null; if (!rebuild) { storedReport = this.m_catalogTempDB.GetCompiledReport(itemContext); if (storedReport != null && storedReport.GeneratedExpressionHostWithRefusedPermissions != this.GenerateExpressionHostWithRefusedPermissions) { storedReport = null; } } if (storedReport == null) { byte[] reportDefinition = this.m_catalog.GetReportDefinition(itemContext); PublishingResult publishingResult = ReportCompiler.CompileReport((ICatalogItemContext)itemContext, reportDefinition, this.GenerateExpressionHostWithRefusedPermissions, out snapshot); storedReport = new StoredReport(publishingResult, snapshot, this.GenerateExpressionHostWithRefusedPermissions); this.m_catalogTempDB.SetCompiledReport(itemContext, storedReport); foreach (DataSourceInfo dataSource in storedReport.PublishingResult.DataSources) { if (!dataSource.IsReference && dataSource.CredentialsRetrieval != DataSourceInfo.CredentialsRetrievalOption.Integrated) { string text = null; string text2 = null; this.m_catalog.GetReportDataSourceCredentials(itemContext, dataSource.Name, out text, out text2); bool flag = !string.IsNullOrEmpty(text); if (flag) { dataSource.SetUserName(text, DataProtectionLocal.Instance); } bool flag2 = text2 != null; if (flag2) { dataSource.SetPassword(text2, DataProtectionLocal.Instance); } if (flag || flag2) { dataSource.CredentialsRetrieval = DataSourceInfo.CredentialsRetrievalOption.Store; } else if (string.IsNullOrEmpty(dataSource.Prompt)) { dataSource.CredentialsRetrieval = DataSourceInfo.CredentialsRetrievalOption.None; } else { dataSource.CredentialsRetrieval = DataSourceInfo.CredentialsRetrievalOption.Prompt; } } } } this.m_securityValidator(itemContext, storedReport.PublishingResult); snapshot = storedReport.Snapshot; return(storedReport.PublishingResult); }
public string[] GetDataSetNames(PreviewItemContext itemContext) { if (this.DataRetrieval.SupportsQueries) { return(new string[0]); } ControlSnapshot controlSnapshot = default(ControlSnapshot); PublishingResult compiledReport = this.GetCompiledReport(itemContext ?? this.m_itemContext, false, out controlSnapshot); return(compiledReport.DataSetsName ?? new string[0]); }
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); }
private void GetAllReportDataSourcesAndSharedDataSets(out RuntimeDataSourceInfoCollection runtimeDataSources, out RuntimeDataSetInfoCollection runtimeDataSets) { if (!DataRetrieval.SupportsQueries) { runtimeDataSources = new RuntimeDataSourceInfoCollection(); runtimeDataSets = new RuntimeDataSetInfoCollection(); return; } ControlSnapshot snapshot; PublishingResult compiledReport = GetCompiledReport(m_itemContext, rebuild: false, out snapshot); DataSourceInfoCollection existingDataSources = ResolveSharedDataSources(compiledReport.DataSources); DataSetInfoCollection dataSetInfoCollection = ResolveSharedDataSets(compiledReport.SharedDataSets); DataSourceInfoCollection dataSources = CompileDataSetsAndCombineDataSources(dataSetInfoCollection, existingDataSources); CreateAndConfigureReportProcessing().GetAllDataSources(m_itemContext, snapshot, OnGetSubReportDataSources, dataSources, dataSetInfoCollection, checkIfUsable: true, new ServerDataSourceSettings(isSurrogatePresent: true, allowIntegratedSecurity: true), out runtimeDataSources, out runtimeDataSets); }
private void GetAllReportDataSourcesAndSharedDataSets(out RuntimeDataSourceInfoCollection runtimeDataSources, out RuntimeDataSetInfoCollection runtimeDataSets) { if (!this.DataRetrieval.SupportsQueries) { runtimeDataSources = new RuntimeDataSourceInfoCollection(); runtimeDataSets = new RuntimeDataSetInfoCollection(); } else { ControlSnapshot getCompiledDefinitionFactory = default(ControlSnapshot); PublishingResult compiledReport = this.GetCompiledReport(this.m_itemContext, false, out getCompiledDefinitionFactory); DataSourceInfoCollection existingDataSources = this.ResolveSharedDataSources(compiledReport.DataSources); DataSetInfoCollection dataSetInfoCollection = this.ResolveSharedDataSets(compiledReport.SharedDataSets); DataSourceInfoCollection dataSources = this.CompileDataSetsAndCombineDataSources(dataSetInfoCollection, existingDataSources); ReportProcessing reportProcessing = this.CreateAndConfigureReportProcessing(); reportProcessing.GetAllDataSources((ICatalogItemContext)this.m_itemContext, (IChunkFactory)getCompiledDefinitionFactory, (ReportProcessing.OnDemandSubReportDataSourcesCallback) this.OnGetSubReportDataSources, dataSources, dataSetInfoCollection, true, new ServerDataSourceSettings(true, true), out runtimeDataSources, out runtimeDataSets); } }
private void OnGetSubReportDefinition(ICatalogItemContext reportContext, string subreportPath, string newChunkName, ReportProcessing.NeedsUpgrade upgradeCheck, ParameterInfoCollection parentQueryParameters, out ICatalogItemContext subreportContext, out string description, out IChunkFactory chunkFactory, out ParameterInfoCollection parameters) { if (reportContext == null) { throw new ArgumentException("OnGetSubReportDefinition: Invalid report context"); } if (upgradeCheck(ReportProcessingFlags.OnDemandEngine)) { throw new Exception("Subreport definition is not compatible with this version of viewer controls"); } subreportContext = reportContext.GetSubreportContext(subreportPath); ControlSnapshot controlSnapshot = default(ControlSnapshot); PublishingResult compiledReport = this.GetCompiledReport((PreviewItemContext)subreportContext, false, out controlSnapshot); controlSnapshot.PrepareExecutionSnapshot(this.m_executionSession.Snapshot, newChunkName); description = compiledReport.ReportDescription; chunkFactory = controlSnapshot; parameters = compiledReport.Parameters; }
/// <summary> /// Add variation to given product + asset + icon + properties /// </summary> private PublishingResult AddVariation(CatalogProduct product, ModuleManifest manifest, byte[] icon, string zipModulePath, PublishingResult publishingResult) { //add variation + asset var variationCode = string.Format("{0}_{1}", manifest.Id, manifest.Version); variationCode = Regex.Replace(variationCode, @"[^A-Za-z0-9_]", "_"); var variation = product.Variations.Where(x => x.Code == variationCode).FirstOrDefault(); if (variation == null) { variation = new CatalogProduct { Name = string.Format("{0} ({1})", manifest.Title, manifest.Version), Code = variationCode, MainProductId = product.Id, CategoryId = product.CategoryId, CatalogId = product.CatalogId, }; AddProperty(variation, "Description", manifest.Description, PropertyValueType.LongText); AddProperty(variation, "ReleaseNote", manifest.ReleaseNotes, PropertyValueType.LongText); AddProperty(variation, "ReleaseVersion", manifest.Version, PropertyValueType.ShortText); AddProperty(variation, "Compatibility", manifest.PlatformVersion, PropertyValueType.ShortText); AddProperty(variation, "ReleaseDate", DateTime.UtcNow, PropertyValueType.DateTime); AddAsset(variation, zipModulePath); if (publishingResult == PublishingResult.None) { AddIcon(variation, Path.GetExtension(manifest.IconUrl), icon); publishingResult = PublishingResult.Variation; } _productService.Create(variation); } return(publishingResult); }
/// <summary> /// Add variation to given product + asset + icon + properties /// </summary> private PublishingResult AddVariation(CatalogProduct product, ModuleManifest manifest, byte[] icon, string zipModulePath, PublishingResult publishingResult) { //add variation + asset var variationCode = string.Format("{0}_{1}", manifest.Id, manifest.Version); variationCode = Regex.Replace(variationCode, @"[^A-Za-z0-9_]", "_"); var variation = product.Variations.Where(x=>x.Code == variationCode).FirstOrDefault(); if (variation == null) { variation = new CatalogProduct { Name = string.Format("{0} ({1})", manifest.Title, manifest.Version), Code = variationCode, MainProductId = product.Id, CategoryId = product.CategoryId, CatalogId = product.CatalogId, }; AddProperty(variation, "Description", manifest.Description, PropertyValueType.LongText); AddProperty(variation, "ReleaseNote", manifest.ReleaseNotes, PropertyValueType.LongText); AddProperty(variation, "ReleaseVersion", manifest.Version, PropertyValueType.ShortText); AddProperty(variation, "Compatibility", manifest.PlatformVersion, PropertyValueType.ShortText); AddProperty(variation, "ReleaseDate", DateTime.UtcNow, PropertyValueType.DateTime); AddAsset(variation, zipModulePath); if (publishingResult == PublishingResult.None) { AddIcon(variation, Path.GetExtension(manifest.IconUrl), icon); publishingResult = PublishingResult.Variation; } _productService.Create(variation); } return publishingResult; }
public StoredReport(PublishingResult publishingResult, ControlSnapshot snapshot, bool generatedExpressionHostWithRefusedPermissions) { this.PublishingResult = publishingResult; this.Snapshot = snapshot; this.GeneratedExpressionHostWithRefusedPermissions = generatedExpressionHostWithRefusedPermissions; }