示例#1
0
        public static GenericContent GetSystemContext(Node child)
        {
            SystemFolder ancestor = null;

            while ((child != null) && ((ancestor = child as SystemFolder) == null))
            {
                child = child.Parent;
            }

            return((ancestor != null) ? ancestor.Parent as GenericContent : null);
        }
示例#2
0
        public Folder GetWorkflowContainer()
        {
            var path      = RepositoryPath.Combine(this.Path, WorkflowContainerName);
            var container = (Folder)Node.LoadNode(path);

            if (container != null)
            {
                return(container);
            }
            container      = new SystemFolder(this);
            container.Name = WorkflowContainerName;
            using (new ContentRepository.Storage.Security.SystemAccount())
                container.Save();
            return(container);
        }
示例#3
0
        private Node GetAppCacheRoot()
        {
            var node = Node.LoadNode(PersistentAppCacheFolderPath);

            if (node != null)
            {
                return(node);
            }
            var folder = new SystemFolder(Repository.SystemFolder);

            folder.Name = PersistentAppCacheFolderName;
            //folder.AddReference("ContentTypes", ContentType.GetByName("ApplicationCacheFile"));
            folder.Save();
            return(folder);
        }
示例#4
0
        private static Node GetMailProcessorWorkflowContainer(Node contextNode)
        {
            var parent = Node.LoadNode(RepositoryPath.Combine(contextNode.Path, "Workflows/MailProcess"));

            if (parent == null)
            {
                var workflows = Node.LoadNode(RepositoryPath.Combine(contextNode.Path, "Workflows"));
                if (workflows == null)
                {
                    using (new SystemAccount())
                    {
                        workflows = new SystemFolder(contextNode)
                        {
                            Name = "Workflows"
                        };

                        try
                        {
                            workflows.Save();
                        }
                        catch (Exception ex)
                        {
                            Logger.WriteException(ex, ExchangeHelper.ExchangeLogCategory);
                            return(null);
                        }
                    }
                }
                using (new SystemAccount())
                {
                    parent = new Folder(workflows)
                    {
                        Name = "MailProcess"
                    };

                    try
                    {
                        parent.Save();
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteException(ex, ExchangeHelper.ExchangeLogCategory);
                        return(null);
                    }
                }
            }
            return(parent);
        }