Exemplo n.º 1
0
        public void PrepareToDelete(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            var itemIDs  = new ListString(args.Parameters["items"]);
            var database = this.factory.GetDatabase(args.Parameters["database"]);

            foreach (var itemID in itemIDs)
            {
                var item = database.GetItem(itemID);
                if (SharepointProvider.IsActiveIntegrationConfigItem(item))
                {
                    args.Parameters[CancelationKey] = CancelationValue;
                    return;
                }

                if (SharepointProvider.IsActiveIntegrationDataItem(item))
                {
                    var integrationItem = new IntegrationItem(item);
                    if (!integrationItem.IsNew)
                    {
                        args.CustomData.Add(itemID, integrationItem.GUID);
                        args.CustomData.Add(itemID + "parentID", item.ParentID);
                    }
                }
            }
        }
        public void Prepare(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNull(args, "args");
            Database   database = GetDatabase(args);
            ListString list     = new ListString(args.Parameters["items"], '|');

            foreach (string id in list)
            {
                Item item = database.GetItem(id);
                if (SharepointProvider.IsActiveIntegrationConfigItem(item))
                {
                    args.Parameters[CancelationKey] = "1";
                }

                if (SharepointProvider.IsActiveIntegrationDataItem(item))
                {
                    if (item != null)
                    {
                        CacheableIntegrationItemInfo cacheableIntegrationItemInfo = IntegrationCache.GetIntegrationItemInfo(item.ID);
                        if (cacheableIntegrationItemInfo != null)
                        {
                            args.Parameters[id] = cacheableIntegrationItemInfo.ParentItemId.ToString();
                            args.Parameters[id + "uniqueId"] = cacheableIntegrationItemInfo.SharepointItemId;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>The process.</summary>
        /// <param name="args">The args.</param>
        public virtual void Process([NotNull] GetItemArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            if (!args.Handled)
            {
                args.Result = args.ItemPath != null?args.FallbackProvider.GetItem(args.ItemPath, args.Language, args.Version, args.Database, args.SecurityCheck) : args.FallbackProvider.GetItem(args.ItemId, args.Language, args.Version, args.Database, args.SecurityCheck);

                args.Handled = true;
            }

            if (IntegrationDisabler.CurrentValue || args.Result == null)
            {
                return;
            }

            if (SharepointProvider.IsActiveIntegrationFolder(args.Result) || SharepointProvider.IsActiveIntegrationDataItem(args.Result))
            {
                SharepointProvider.ProcessItem(args.Result, ProcessIntegrationItemsOptions.DefaultAsyncOptions);
            }
        }
Exemplo n.º 4
0
        public void OnItemSaved(object sender, EventArgs args)
        {
            var item = Event.ExtractParameter(args, 0) as Item;

            Assert.IsNotNull(item, "No item in parameters");
            if (IntegrationDisabler.CurrentValue)
            {
                return;
            }

            if (SharepointProvider.IsActiveIntegrationDataItem(item))
            {
                var integrationItem = new IntegrationItem(item);
                if (!integrationItem.IsNew)
                {
                    using (new IntegrationDisabler())
                    {
                        this.AddToTable(PrefixSave, integrationItem.GUID, item.ParentID);
                    }
                }
            }
        }