/// <summary>
        /// Converts the Configuration to a ProvisioningTemplateCreationInformation object for backwards compatibility
        /// </summary>
        /// <param name="web"></param>
        /// <returns></returns>
        public ProvisioningTemplateCreationInformation ToCreationInformation(Web web)
        {
            var ci = new ProvisioningTemplateCreationInformation(web)
            {
                ExtractConfiguration = this,

                PersistBrandingFiles               = PersistAssetFiles,
                PersistPublishingFiles             = PersistAssetFiles,
                BaseTemplate                       = web.GetBaseTemplate(),
                FileConnector                      = this.FileConnector,
                IncludeAllClientSidePages          = this.Pages.IncludeAllClientSidePages,
                IncludeHiddenLists                 = this.Lists.IncludeHiddenLists,
                IncludeSiteGroups                  = this.SiteSecurity.IncludeSiteGroups,
                ContentTypeGroupsToInclude         = this.ContentTypes.Groups,
                IncludeContentTypesFromSyndication = !this.ContentTypes.ExcludeFromSyndication,
                IncludeTermGroupsSecurity          = this.Taxonomy.IncludeSecurity,
                IncludeSiteCollectionTermGroup     = this.Taxonomy.IncludeSiteCollectionTermGroup,
                IncludeSearchConfiguration         = this.SearchSettings.Include,
                IncludeAllTermGroups               = this.Taxonomy.IncludeAllTermGroups,
                ExtensibilityHandlers              = this.Extensibility.Handlers
            };

            ci.IncludeAllTermGroups         = this.Taxonomy.IncludeAllTermGroups;
            ci.IncludeNativePublishingFiles = this.Publishing.IncludeNativePublishingFiles;
            ci.ListsToExtract = this.Lists != null && this.Lists.Lists.Any() ? this.Lists.Lists.Select(l => l.Title).ToList() : null;
            ci.PersistMultiLanguageResources = this.MultiLanguage.PersistResources;
            ci.PersistPublishingFiles        = this.Publishing.Persist;
            ci.ResourceFilePrefix            = this.MultiLanguage.ResourceFilePrefix;

            if (Handlers.Any())
            {
                ci.HandlersToProcess = Model.Handlers.None;
                foreach (var handler in Handlers)
                {
                    Model.Handlers handlerEnumValue = Model.Handlers.None;
                    switch (handler)
                    {
                    case ConfigurationHandler.Pages:
                        handlerEnumValue = Model.Handlers.PageContents;
                        break;

                    case ConfigurationHandler.Taxonomy:
                        handlerEnumValue = Model.Handlers.TermGroups;
                        break;

                    default:
                        handlerEnumValue = (Model.Handlers)Enum.Parse(typeof(Model.Handlers), handler.ToString());
                        break;
                    }
                    ci.HandlersToProcess |= handlerEnumValue;
                }
            }
            else
            {
                ci.HandlersToProcess = Model.Handlers.All;
            }

            if (this.ProgressDelegate != null)
            {
                ci.ProgressDelegate = (message, step, total) =>
                {
                    ProgressDelegate(message, step, total);
                };
            }
            if (this.MessagesDelegate != null)
            {
                ci.MessagesDelegate = (message, type) =>
                {
                    MessagesDelegate(message, type);
                };
            }


            return(ci);
        }
Example #2
0
        public ProvisioningTemplateApplyingInformation ToApplyingInformation()
        {
            var ai = new ProvisioningTemplateApplyingInformation();

            ai.ApplyConfiguration = this;

            if (this.AccessTokens != null && this.AccessTokens.Any())
            {
                ai.AccessTokens = this.AccessTokens;
            }

            ai.ProvisionContentTypesToSubWebs   = this.ContentTypes.ProvisionContentTypesToSubWebs;
            ai.OverwriteSystemPropertyBagValues = this.PropertyBag.OverwriteSystemValues;
            ai.IgnoreDuplicateDataRowErrors     = this.Lists.IgnoreDuplicateDataRowErrors;
            ai.ClearNavigation          = this.Navigation.ClearNavigation;
            ai.ProvisionFieldsToSubWebs = this.Fields.ProvisionFieldsToSubWebs;

            if (Handlers.Any())
            {
                ai.HandlersToProcess = Model.Handlers.None;
                foreach (var handler in Handlers)
                {
                    Model.Handlers handlerEnumValue = Model.Handlers.None;
                    switch (handler)
                    {
                    case ConfigurationHandler.Pages:
                        handlerEnumValue = Model.Handlers.PageContents;
                        break;

                    case ConfigurationHandler.Taxonomy:
                        handlerEnumValue = Model.Handlers.TermGroups;
                        break;

                    default:
                        handlerEnumValue = (Model.Handlers)Enum.Parse(typeof(Model.Handlers), handler.ToString());
                        break;
                    }
                    ai.HandlersToProcess |= handlerEnumValue;
                }
            }
            else
            {
                ai.HandlersToProcess = Model.Handlers.All;
            }

            if (this.ProgressDelegate != null)
            {
                ai.ProgressDelegate = (message, step, total) =>
                {
                    ProgressDelegate(message, step, total);
                };
            }
            if (this.MessagesDelegate != null)
            {
                ai.MessagesDelegate = (message, type) =>
                {
                    MessagesDelegate(message, type);
                };
            }
            if (this.SiteProvisionedDelegate != null)
            {
                ai.SiteProvisionedDelegate = (title, siteUrl) =>
                {
                    SiteProvisionedDelegate(title, siteUrl);
                };
            }

            return(ai);
        }
Example #3
0
        public ProvisioningTemplateCreationInformation ToCreationInformation(Web web)
        {
            var ci = new ProvisioningTemplateCreationInformation(web);

            ci.ExtractConfiguration = this;

            ci.PersistBrandingFiles = PersistAssetFiles;

            if (Handlers.Any())
            {
                ci.HandlersToProcess = Model.Handlers.None;
                foreach (var handler in Handlers)
                {
                    Model.Handlers handlerEnumValue = Model.Handlers.None;
                    switch (handler)
                    {
                    case ConfigurationHandler.Pages:
                        handlerEnumValue = Model.Handlers.PageContents;
                        break;

                    case ConfigurationHandler.Taxonomy:
                        handlerEnumValue = Model.Handlers.TermGroups;
                        break;

                    default:
                        handlerEnumValue = (Model.Handlers)Enum.Parse(typeof(Model.Handlers), handler.ToString());
                        break;
                    }
                    ci.HandlersToProcess |= handlerEnumValue;
                }
            }
            else
            {
                ci.HandlersToProcess = Model.Handlers.All;
            }

            if (this.Pages != null)
            {
                ci.IncludeAllClientSidePages = this.Pages.IncludeAllClientSidePages;
            }
            if (this.Lists != null)
            {
                ci.IncludeHiddenLists = this.Lists.IncludeHiddenLists;
            }
            if (this.SiteSecurity != null)
            {
                ci.IncludeSiteGroups = this.SiteSecurity.IncludeSiteGroups;
            }
            if (this.ContentTypes != null)
            {
                ci.ContentTypeGroupsToInclude         = this.ContentTypes.Groups;
                ci.IncludeContentTypesFromSyndication = !this.ContentTypes.ExcludeFromSyndication;
            }
            if (this.Taxonomy != null)
            {
                ci.IncludeTermGroupsSecurity      = this.Taxonomy.IncludeSecurity;
                ci.IncludeSiteCollectionTermGroup = this.Taxonomy.IncludeSiteCollectionTermGroup;
            }
            if (this.SearchSettings != null)
            {
                ci.IncludeSearchConfiguration = this.SearchSettings.Include;
            }
            return(ci);
        }