Пример #1
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 static TargetType GetTargetType(PublishingContext publishingContext)
 {
     PublicationTarget publicationTarget = publishingContext.PublicationTarget;
     // Fixme (when API is fixed): remove this function and instead use: "TargetType targetType = publishingContext.TargetType";
     TargetType targetType = (publicationTarget != null) ? publicationTarget.TargetTypes.FirstOrDefault() : null;
     return targetType;
 }
        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);
        }
Пример #4
0
        public static string GetCdEnvironmentPurpose(PublishingContext publishingContext)
        {
            TargetType targetType = publishingContext.TargetType;
            if (targetType == null || targetType.BusinessProcessType == null)
            {
                // Template Debugger, CM Preview or old-style publishing
                return null;
            }

            // New-style publishing
            return targetType.Purpose;
        }
Пример #5
0
        public static string GetCdEnvironmentPurpose(PublishingContext publishingContext)
        {
            TargetType targetType = publishingContext.TargetType;

            if (targetType == null || targetType.BusinessProcessType == null)
            {
                // Template Debugger, CM Preview or old-style publishing
                return(null);
            }

            // New-style publishing
            return(targetType.Purpose);
        }
 public void PublisherTypesComboboxRefresh()
 {
     using (PublishingContext db = new PublishingContext())
     {
         var publishers = db.Publishers.ToList();
         foreach (Publisher p in publishers)
         {
             if (!PublisherTypesCollection.Contains(p.PublisherName))
             {
                 PublisherTypesCollection.Add(p.PublisherName.ToString());
             }
         }
     }
 }
Пример #7
0
        public static bool IsXpmEnabled(PublishingContext publishingContext)
        {
            if (publishingContext == null || publishingContext.PublicationTarget == null)
            {
                return false;
            }

            TargetType targetType = publishingContext.TargetType;
            if (targetType != null && targetType.BusinessProcessType != null)
            {
                // New-style publishing
                Publication contextPublication = (Publication) ((RepositoryLocalObject) publishingContext.ResolvedItem.Item).ContextRepository;
                return targetType.IsPreviewCapable(contextPublication);
            }

            return IsPublicationTargetXpmEnabled(publishingContext.PublicationTarget);
        }
Пример #8
0
        public static bool IsXpmEnabled(PublishingContext publishingContext)
        {
            if (publishingContext?.PublicationTarget == null)
            {
                return(false);
            }

            TargetType targetType = publishingContext.TargetType;

            if (targetType?.BusinessProcessType != null)
            {
                // New-style publishing
                Publication contextPublication = (Publication)((RepositoryLocalObject)publishingContext.ResolvedItem.Item).ContextRepository;
                return(targetType.IsPreviewCapable(contextPublication));
            }

            return(IsPublicationTargetXpmEnabled(publishingContext.PublicationTarget));
        }
Пример #9
0
        public static string GetCdEnvironmentPurpose(PublishingContext publishingContext)
        {
            if (!Session.ApiVersion.StartsWith("8."))
            {
                return(null);
            }

            // We're going to use new properties which are only available in CM 8.1 and higher.
            // To avoid having to reference CM 8.1 APIs (which won't bind on CM 7.1), we use dynamic types here.
            dynamic pubContext = publishingContext;
            dynamic targetType = pubContext.TargetType;

            if (targetType == null || targetType.BusinessProcessType == null)
            {
                // Template Debugger, CM Preview or old-style publishing
                return(null);
            }

            // New-style publishing
            return(targetType.Purpose);
        }
Пример #10
0
        public static bool IsXpmEnabled(PublishingContext publishingContext)
        {
            if (publishingContext == null || publishingContext.PublicationTarget == null)
            {
                return(false);
            }

            if (Session.ApiVersion.StartsWith("8."))
            {
                // We're going to use new properties which are only available in CM 8.1 and higher.
                // To avoid having to reference CM 8.1 APIs (which won't bind on CM 7.1), we use dynamic types here.
                dynamic pubContext = publishingContext;
                dynamic targetType = pubContext.TargetType;
                if (targetType != null && targetType.BusinessProcessType != null)
                {
                    // New-style publishing
                    Publication contextPublication = (Publication)((RepositoryLocalObject)publishingContext.ResolvedItem.Item).ContextRepository;
                    return(targetType.IsPreviewCapable(contextPublication));
                }
            }

            return(IsPublicationTargetXpmEnabled(publishingContext.PublicationTarget));
        }
Пример #11
0
 public void AttachContext(PublishingContext context)
 {
     Context = context;
 }