Beispiel #1
0
        public void Process(SynchronizeTreeArgs args)
        {
            Diagnostics.Assert.ArgumentNotNull(args, "args");
            Diagnostics.Assert.IsNotNull(args.Context, "Value can't be null: args.Context");

            args.IntegrationItems = args.Context.ParentItem.Children.Where(SharepointProvider.IsIntegrationItem).Select(x => new IntegrationItem(x)).ToList();
        }
        public void Process(SynchronizeTreeArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.IsNotNull(args.ActionList, "Value can't be null: args.ActionList");

            args.ActionList.ForEach(x => x.Execute());
        }
        public void Process(SynchronizeTreeArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            if (!this.IsIntegration)
            {
                args.AbortPipeline();
            }

            if (!args.Options.IsEvent)
            {
                this.eventManager.QueueEvent(new ProcessTreeRemoteEvent(args.Context.ParentID, args.Context.Database.Name));
            }
        }
        public void Process(SynchronizeTreeArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.IsNotNull(args.Context, "Value can't be null: args.Context");

            var context = this.contextProvider.CreateDataContext(args.Context.IntegrationConfigData);
            var list    = this.provider.GetList(args.Context.IntegrationConfigData.Web, args.Context.IntegrationConfigData.List, context);

            var itemCollection = list.GetItems(new ItemsRetrievingOptions
            {
                Folder    = args.Context.IntegrationConfigData.Folder,
                ItemLimit = args.Context.IntegrationConfigData.ItemLimit,
                ViewName  = args.Context.IntegrationConfigData.View
            });

            args.SharepointItemList = itemCollection.ToList();
        }
        public void Process(SynchronizeTreeArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.IsNotNull(args.Context, "Value can't be null: args.Context");

            // TODO: Find way to cover disabler with unit tests.
            using (new IntegrationDisabler())
            {
                var parent = args.Context.ParentItem;
                while (parent != null && (parent.TemplateID == TemplateIDs.IntegrationConfig || parent.TemplateID == TemplateIDs.IntegrationFolder))
                {
                    if (!new IntegrationItem(parent).IsActive)
                    {
                        args.AbortPipeline();
                        break;
                    }

                    parent = parent.Parent;
                }
            }
        }
        public void Process(SynchronizeTreeArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.IsNotNull(args.IntegrationItems, "Value can't be null: args.IntegrationItems");
            Assert.IsNotNull(args.SharepointItemList, "Value can't be null: args.SharepointItemList");
            Assert.IsNotNull(args.Context, "Value can't be null: args.Context");

            var actions = new List <SyncActionBase>();

            var isBidirectional      = args.Context.IntegrationConfigData.BidirectionalLink;
            var unprocessedBaseItems = args.SharepointItemList.ToDictionary(item => item.GUID);

            foreach (var integrationItem in args.IntegrationItems)
            {
                ObjectModel.Entities.Items.BaseItem sharepointItem;
                if (unprocessedBaseItems.TryGetValue(integrationItem.GUID, out sharepointItem))
                {
                    if (this.historyProvider.IsItemDeleted(args, integrationItem.GUID))
                    {
                        continue;
                    }

                    unprocessedBaseItems.Remove(integrationItem.GUID);
                    if (integrationItem.IsActive)
                    {
                        if (isBidirectional && this.historyProvider.IsItemChanged(args, integrationItem.GUID))
                        {
                            actions.Add(this.actionFactory.GetUpdateSharepointItemAction(args, sharepointItem, integrationItem));
                        }
                        else
                        {
                            actions.Add(this.actionFactory.GetUpdateIntegrationItemAction(args, integrationItem, sharepointItem));
                        }
                    }
                }
                else
                {
                    if (isBidirectional && integrationItem.IsNew)
                    {
                        actions.Add(this.actionFactory.GetCreateSharepointItemAction(args, integrationItem));
                    }
                    else if (integrationItem.IsActive)
                    {
                        actions.Add(this.actionFactory.GetDeleteIntegrationItemAction(args, integrationItem));
                    }
                }
            }

            foreach (var baseItem in unprocessedBaseItems.Values)
            {
                if (isBidirectional && this.historyProvider.IsItemDeleted(args, baseItem.GUID))
                {
                    actions.Add(this.actionFactory.GetDeleteSharepointItemAction(args, baseItem));
                }
                else
                {
                    actions.Add(this.actionFactory.GetCreateIntegrationItemAction(args, baseItem));
                }
            }

            args.ActionList = actions;
        }
        public void Process(SynchronizeTreeArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            IntegrationCache.AddIntegrationConfigData(args.Context.ParentID, args.Context.IntegrationConfigData, (args.Context.IntegrationConfigData.ExpirationInterval > 0) ? args.Context.IntegrationConfigData.ExpirationInterval : SharepointProvider.DefaultTimeout);
        }