Пример #1
0
        public void PackXsltFunction(PackageCreator pc)
        {
            IXsltFunction xsltFunction;
            try
            {
                xsltFunction = (from i in DataFacade.GetData<IXsltFunction>()
                                where i.Namespace + "." + i.Name == this.Id
                                select i).First();
            }
            catch (Exception)
            {
                throw new ArgumentException(string.Format(@"XSLT Function '{0}' doesn't exists", this.Id));
            }

            var newXslFilePath = "\\" + xsltFunction.Namespace.Replace(".", "\\") + "\\" + xsltFunction.Name + ".xsl";

            pc.AddFile("App_Data\\Xslt" + xsltFunction.XslFilePath, "App_Data\\Xslt" + newXslFilePath);
            xsltFunction.XslFilePath = newXslFilePath;

            pc.AddData(xsltFunction);

            var parameters = from i in DataFacade.GetData<IParameter>()
                             where i.OwnerId == xsltFunction.Id
                             orderby i.Position
                             select i;

            foreach (var parameter in parameters) pc.AddData(parameter);

            var namedFunctionCalls = from i in DataFacade.GetData<INamedFunctionCall>()
                                     where i.XsltFunctionId == xsltFunction.Id
                                     orderby i.Name
                                     select i;

            foreach (var namedFunctionCall in namedFunctionCalls) pc.AddData(namedFunctionCall);
        }
Пример #2
0
        public void PackInlineFunction(PackageCreator creator)
        {
            var inlineFunction = DataFacade.GetData<IInlineFunction>(data => (data.Namespace + "." + data.Name) == this.Name).FirstOrDefault();
            if (inlineFunction != null)
            {

                var inlineFunctionId = inlineFunction.Id;
                creator.AddData(inlineFunction);
                creator.AddData<IInlineFunctionAssemblyReference>(d => d.Function == inlineFunctionId);
                creator.AddData<IParameter>(d => d.OwnerId == inlineFunctionId);

                creator.AddFile(string.Format(@"App_Data\Composite\InlineCSharpFunctions\{0}", inlineFunction.CodePath));
            }
        }
Пример #3
0
        public void PackInlineFunction(PackageCreator creator)
        {
            var inlineFunction = DataFacade.GetData <IInlineFunction>(data => (data.Namespace + "." + data.Name) == this.Name).FirstOrDefault();

            if (inlineFunction != null)
            {
                var inlineFunctionId = inlineFunction.Id;
                creator.AddData(inlineFunction);
                creator.AddData <IInlineFunctionAssemblyReference>(d => d.Function == inlineFunctionId);
                creator.AddData <IParameter>(d => d.OwnerId == inlineFunctionId);

                creator.AddFile(string.Format(@"App_Data\Composite\InlineCSharpFunctions\{0}", inlineFunction.CodePath));
            }
        }
Пример #4
0
        public void Pack(PackageCreator creator)
        {
            var path = Path;

            Func <IMediaFileData, bool>   fileFilter   = file => TestFile(file, path) && !creator.ExcludedPaths.Any(p => TestFile(file, p));
            Func <IMediaFolderData, bool> folderFilter = folder => TestFolder(folder, path) && !creator.ExcludedPaths.Any(p => TestFolder(folder, p));

            creator.AddData(fileFilter);
            creator.AddData(folderFilter);

            var files = DataFacade.GetData <IMediaFileData>().Where(fileFilter).ToList();

            foreach (var mediaFileData in files)
            {
                creator.AddFileIfExists(@"App_Data\Media\" + mediaFileData.Id);
            }
        }
Пример #5
0
        private void PackPageTree(PackageCreator pc, Guid pageId, bool isRoot = false)
        {
            var page = PageManager.GetPageById(pageId, true);

            if (page == null)             // Page does not exists in current locale
            {
                return;
            }

            foreach (var childPageId in PageManager.GetChildrenIDs(pageId))
            {
                if (pc.ExcludedIds.Contains(childPageId))
                {
                    continue;
                }

                PackPageTree(pc, childPageId);
            }

            foreach (var dataScopeIdentifier in DataFacade.GetSupportedDataScopes(typeof(IPage)))
            {
                using (new DataScope(dataScopeIdentifier))
                {
                    var pageinScope = PageManager.GetPageById(pageId, true);
                    if (pageinScope != null)
                    {
                        pc.AddData(pageinScope);
                        pc.AddData <IPagePlaceholderContent>(dataScopeIdentifier, d => d.PageId == pageId);
                    }
                }
            }

            if (isRoot)
            {
                using (new DataScope(DataScopeIdentifier.Public))
                {
                    var pageStructure = DataFacade.BuildNew <IPageStructure>();
                    pageStructure.Id            = pageId;
                    pageStructure.ParentId      = Guid.Empty;
                    pageStructure.LocalOrdering = PageManager.GetLocalOrdering(pageId);
                    pc.AddData(pageStructure);
                }
            }
            else
            {
                pc.AddData <IPageStructure>(d => d.Id == pageId);
            }

            if (IncludeData)
            {
                pc.AddData <IDataItemTreeAttachmentPoint>(d => d.KeyValue == ValueTypeConverter.Convert <string>(pageId));
                pc.AddData <IPageFolderDefinition>(d => d.PageId == pageId);

                foreach (Type folderType in page.GetDefinedFolderTypes())
                {
                    pc.AddData(folderType, d => (d as IPageRelatedData).PageId == pageId);
                }
            }
        }
Пример #6
0
        public void PackXsltFunction(PackageCreator pc)
        {
            IXsltFunction xsltFunction;

            try
            {
                xsltFunction = (from i in DataFacade.GetData <IXsltFunction>()
                                where i.Namespace + "." + i.Name == this.Id
                                select i).First();
            }
            catch (Exception)
            {
                throw new ArgumentException(string.Format(@"XSLT Function '{0}' doesn't exists", this.Id));
            }

            var newXslFilePath = "\\" + xsltFunction.Namespace.Replace(".", "\\") + "\\" + xsltFunction.Name + ".xsl";


            pc.AddFile("App_Data\\Xslt" + xsltFunction.XslFilePath, "App_Data\\Xslt" + newXslFilePath);
            xsltFunction.XslFilePath = newXslFilePath;

            pc.AddData(xsltFunction);

            var parameters = from i in DataFacade.GetData <IParameter>()
                             where i.OwnerId == xsltFunction.Id
                             orderby i.Position
                             select i;

            foreach (var parameter in parameters)
            {
                pc.AddData(parameter);
            }

            var namedFunctionCalls = from i in DataFacade.GetData <INamedFunctionCall>()
                                     where i.XsltFunctionId == xsltFunction.Id
                                     orderby i.Name
                                     select i;

            foreach (var namedFunctionCall in namedFunctionCalls)
            {
                pc.AddData(namedFunctionCall);
            }
        }
Пример #7
0
        public void Pack(PackageCreator creator)
        {
            if (Id == _pagesName)
            {
                #region All Pages
                HashSet <Guid> pages;
                using (var scope = new DataScope(DataScopeIdentifier.Administrated))
                {
                    pages = DataFacade.GetData <IPage>().Select(p => p.Id).ToHashSet();
                }

                creator.AddData(typeof(IPage), DataScopeIdentifier.Public, d => pages.Contains((d as IPage).Id));
                creator.AddData(typeof(IPage), DataScopeIdentifier.Administrated, d => pages.Contains((d as IPage).Id));
                creator.AddData(typeof(IPagePlaceholderContent), DataScopeIdentifier.Public, d => pages.Contains((d as IPagePlaceholderContent).PageId));
                creator.AddData(typeof(IPagePlaceholderContent), DataScopeIdentifier.Administrated, d => pages.Contains((d as IPagePlaceholderContent).PageId));
                creator.AddData(typeof(IPageStructure), DataScopeIdentifier.Public, d => pages.Contains((d as IPageStructure).Id));
                #endregion
            }
            else if (Id == _mediasName)
            {
                creator.AddData(typeof(IMediaFileData));
                creator.AddData(typeof(IMediaFolderData));
                creator.AddFilesInDirectory(@"App_Data\Media\");
            }
            else if (Id == _datatypesName)
            {
                IEnumerable <Type> pageDataTypeInterfaces = PageFolderFacade.GetAllFolderTypes();
                IEnumerable <Type> pageMetaTypeInterfaces = PageMetaDataFacade.GetAllMetaDataTypes();

                foreach (var pageDataType in pageDataTypeInterfaces)
                {
                    creator.AddDataTypeData(pageDataType);
                }
                foreach (var pageMetaType in pageMetaTypeInterfaces)
                {
                    creator.AddDataTypeData(pageMetaType);
                }
            }
            else if (Id == _applicationsName)
            {
                creator.AddData <IDataItemTreeAttachmentPoint>();
            }
            else if (Id == _metatypesName)
            {
                IEnumerable <Type> pageMetaTypeInterfaces = PageMetaDataFacade.GetAllMetaDataTypes();

                foreach (var pageMetaType in pageMetaTypeInterfaces)
                {
                    creator.AddDataTypeData(pageMetaType);
                }
            }
            return;
        }
Пример #8
0
 public void Pack(PackageCreator creator)
 {
     var pageType = DataFacade.GetData<IPageType>(d => d.Name == this.Name).FirstOrDefault();
     if (pageType == null)
         throw new InvalidOperationException(string.Format("PageType '{0}' does not exists", this.Name));
     var pageTypeId = pageType.Id;
     creator.AddData(pageType);
     creator.AddData<IPageTypeDataFolderTypeLink>(d => d.PageTypeId == pageTypeId);
     creator.AddData<IPageTypeDefaultPageContent>(d => d.PageTypeId == pageTypeId);
     creator.AddData<IPageTypeMetaDataTypeLink>(d => d.PageTypeId == pageTypeId);
     creator.AddData<IPageTypePageTemplateRestriction>(d => d.PageTypeId == pageTypeId);
     creator.AddData<IPageTypeParentRestriction>(d => d.PageTypeId == pageTypeId);
     creator.AddData<IPageTypeTreeLink>(d => d.PageTypeId == pageTypeId);
     foreach (var pageMetaDataDefinition in DataFacade.GetData<IPageMetaDataDefinition>(d => d.DefiningItemId == pageTypeId))
     {
         creator.AddData(pageMetaDataDefinition);
         creator.AddData<ICompositionContainer>(d => d.Id == pageMetaDataDefinition.MetaDataContainerId);
     }
 }
Пример #9
0
 public void PackVisualFunction(PackageCreator pc)
 {
     IVisualFunction visualFunction;
     try
     {
         visualFunction = (from i in DataFacade.GetData<IVisualFunction>()
                           where i.Namespace + "." + i.Name == this.Id
                           select i).First();
     }
     catch (Exception)
     {
         throw new ArgumentException(string.Format(@"Visual Function '{0}' doesn't exists", this.Id));
     }
     pc.AddData(visualFunction);
 }
Пример #10
0
        public void PackVisualFunction(PackageCreator pc)
        {
            IVisualFunction visualFunction;

            try
            {
                visualFunction = (from i in DataFacade.GetData <IVisualFunction>()
                                  where i.Namespace + "." + i.Name == this.Id
                                  select i).First();
            }
            catch (Exception)
            {
                throw new ArgumentException(string.Format(@"Visual Function '{0}' doesn't exists", this.Id));
            }
            pc.AddData(visualFunction);
        }
Пример #11
0
        public void PackCSharpFunction(PackageCreator pc)
        {
            IMethodBasedFunctionInfo csharpFunction;
            try
            {
                csharpFunction = (from i in DataFacade.GetData<IMethodBasedFunctionInfo>()
                                  where i.Namespace + "." + i.UserMethodName == this.Id
                                  select i).First();
            }
            catch (Exception)
            {
                throw new ArgumentException(string.Format(@"C# Function '{0}' doesn't exists", this.Id));
            }

            pc.AddData(csharpFunction);
        }
Пример #12
0
        public void PackCSharpFunction(PackageCreator pc)
        {
            IMethodBasedFunctionInfo csharpFunction;

            try
            {
                csharpFunction = (from i in DataFacade.GetData <IMethodBasedFunctionInfo>()
                                  where i.Namespace + "." + i.UserMethodName == this.Id
                                  select i).First();
            }
            catch (Exception)
            {
                throw new ArgumentException(string.Format(@"C# Function '{0}' doesn't exists", this.Id));
            }

            pc.AddData(csharpFunction);
        }
Пример #13
0
        public void Pack(PackageCreator creator)
        {
            var pageType = DataFacade.GetData <IPageType>(d => d.Name == this.Name).FirstOrDefault();

            if (pageType == null)
            {
                throw new InvalidOperationException(string.Format("PageType '{0}' does not exists", this.Name));
            }
            var pageTypeId = pageType.Id;

            creator.AddData(pageType);
            creator.AddData <IPageTypeDataFolderTypeLink>(d => d.PageTypeId == pageTypeId);
            creator.AddData <IPageTypeDefaultPageContent>(d => d.PageTypeId == pageTypeId);
            creator.AddData <IPageTypeMetaDataTypeLink>(d => d.PageTypeId == pageTypeId);
            creator.AddData <IPageTypePageTemplateRestriction>(d => d.PageTypeId == pageTypeId);
            creator.AddData <IPageTypeParentRestriction>(d => d.PageTypeId == pageTypeId);
            creator.AddData <IPageTypeTreeLink>(d => d.PageTypeId == pageTypeId);
            foreach (var pageMetaDataDefinition in DataFacade.GetData <IPageMetaDataDefinition>(d => d.DefiningItemId == pageTypeId))
            {
                creator.AddData(pageMetaDataDefinition);
                creator.AddData <ICompositionContainer>(d => d.Id == pageMetaDataDefinition.MetaDataContainerId);
            }
        }
Пример #14
0
        private void PackPageTree(PackageCreator pc, Guid pageId, bool isRoot = false)
        {
            var page = PageManager.GetPageById(pageId, true);
            if (page == null) // Page does not exists in current locale
                return;

            foreach (var childPageId in PageManager.GetChildrenIDs(pageId))
            {
                if (pc.ExcludedIds.Contains(childPageId))
                    continue;

                PackPageTree(pc, childPageId);
            }

            foreach (var dataScopeIdentifier in DataFacade.GetSupportedDataScopes(typeof(IPage)))
            {
                using (new DataScope(dataScopeIdentifier))
                {
                    var pageinScope = PageManager.GetPageById(pageId, true);
                    if (pageinScope != null)
                    {
                        pc.AddData(pageinScope);
                        pc.AddData<IPagePlaceholderContent>(dataScopeIdentifier, d => d.PageId == pageId);
                    }
                }
            }

            if (isRoot)
            {
                using (new DataScope(DataScopeIdentifier.Public))
                {
                    var pageStructure = DataFacade.BuildNew<IPageStructure>();
                    pageStructure.Id = pageId;
                    pageStructure.ParentId = Guid.Empty;
                    pageStructure.LocalOrdering = PageManager.GetLocalOrdering(pageId);
                    pc.AddData(pageStructure);
                }
            }
            else
            {
                pc.AddData<IPageStructure>(d => d.Id == pageId);
            }

            if (IncludeData)
            {
                pc.AddData<IDataItemTreeAttachmentPoint>(d => d.KeyValue == ValueTypeConverter.Convert<string>(pageId));
                pc.AddData<IPageFolderDefinition>(d => d.PageId == pageId);

                foreach (Type folderType in page.GetDefinedFolderTypes())
                {
                    pc.AddData(folderType, d => (d as IPageRelatedData).PageId == pageId);
                }
            }
        }
Пример #15
0
        public void Pack(PackageCreator creator)
        {
            if (Id == _pagesName)
            {
                #region All Pages
                HashSet<Guid> pages;
                using (var scope = new DataScope(DataScopeIdentifier.Administrated))
                {
                    pages = DataFacade.GetData<IPage>().Select(p => p.Id).ToHashSet();
                }

                creator.AddData(typeof(IPage), DataScopeIdentifier.Public, d => pages.Contains((d as IPage).Id));
                creator.AddData(typeof(IPage), DataScopeIdentifier.Administrated, d => pages.Contains((d as IPage).Id));
                creator.AddData(typeof(IPagePlaceholderContent), DataScopeIdentifier.Public, d => pages.Contains((d as IPagePlaceholderContent).PageId));
                creator.AddData(typeof(IPagePlaceholderContent), DataScopeIdentifier.Administrated, d => pages.Contains((d as IPagePlaceholderContent).PageId));
                creator.AddData(typeof(IPageStructure), DataScopeIdentifier.Public, d => pages.Contains((d as IPageStructure).Id));
                #endregion

            }
            else if (Id == _mediasName)
            {
                creator.AddData(typeof(IMediaFileData));
                creator.AddData(typeof(IMediaFolderData));
                creator.AddFilesInDirectory(@"App_Data\Media\");
            }
            else if (Id == _datatypesName)
            {
                IEnumerable<Type> pageDataTypeInterfaces = PageFolderFacade.GetAllFolderTypes();
                IEnumerable<Type> pageMetaTypeInterfaces = PageMetaDataFacade.GetAllMetaDataTypes();

                foreach (var pageDataType in pageDataTypeInterfaces)
                {
                    creator.AddDataTypeData(pageDataType);
                }
                foreach (var pageMetaType in pageMetaTypeInterfaces)
                {
                    creator.AddDataTypeData(pageMetaType);
                }

            }
            else if (Id == _applicationsName)
            {
                creator.AddData<IDataItemTreeAttachmentPoint>();
            }
            else if (Id == _metatypesName)
            {

                IEnumerable<Type> pageMetaTypeInterfaces = PageMetaDataFacade.GetAllMetaDataTypes();

                foreach (var pageMetaType in pageMetaTypeInterfaces)
                {
                    creator.AddDataTypeData(pageMetaType);
                }

            }
            return;
        }
Пример #16
0
        public void Pack(PackageCreator creator)
        {
            var path = Path;

            Func<IMediaFileData, bool> fileFilter = file => TestFile(file, path) && !creator.ExcludedPaths.Any(p => TestFile(file, p));
            Func<IMediaFolderData, bool> folderFilter = folder => TestFolder(folder, path) && !creator.ExcludedPaths.Any(p => TestFolder(folder, p));

            creator.AddData(fileFilter);
            creator.AddData(folderFilter);

            var files = DataFacade.GetData<IMediaFileData>().Where(fileFilter).ToList();
            foreach (var mediaFileData in files)
            {
                creator.AddFileIfExists(@"App_Data\Media\" + mediaFileData.Id);
            }
        }