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; } } } } }
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); } } } }
/// <summary> /// Runs synchronization for integration configuration items with checked ScheduledBlobTransfer field. /// </summary> /// <param name="itemArray"> /// The item array. /// </param> /// <param name="commandItem"> /// The command item. /// </param> /// <param name="scheduledItem"> /// The scheduled item. /// </param> public void Execute(Item[] itemArray, CommandItem commandItem, ScheduleItem scheduledItem) { try { Database database = commandItem.Database; string query = string.Format("fast://*[@{0} = '1' and @@templateid = '{1}']", FieldNames.ScheduledBlobTransfer, TemplateIDs.IntegrationConfig); Item[] items = database.SelectItems(query); foreach (var item in items) { var processIntegrationItemsOptions = new ProcessIntegrationItemsOptions { Force = true, ScheduledBlobTransfer = true, Recursive = true, AsyncIntegration = true }; SharepointProvider.ProcessTree(item, processIntegrationItemsOptions); } } catch (Exception exception) { Log.Error("Tasks.ScheduledBlobTransfer.Execute() failed", exception); } }
public override bool ExecuteAction() { var resultArgs = IntegrationPipelinesRunner.UpdateIntegrationItem(this.item.ID, this.SharepointItem, this.SynchContext, this.options, EventSender.Sharepoint); if (this.options.Recursive && SharepointProvider.IsActiveIntegrationFolder(this.item.InnerItem)) { IntegrationPipelinesRunner.SynchronizeTree(this.options, new SynchContext(this.item.InnerItem)); } return(resultArgs != null); }
public void OnItemSaved(object sender, EventArgs args) { Assert.ArgumentNotNull(sender, "sender"); var item = Event.ExtractParameter(args, 0) as Item; Assert.IsNotNull(item, "No item in parameters"); using (new IntegrationDisabler()) { if (SharepointProvider.IsActiveIntegrationConfigItem(item)) { RemoveChildIntegrationFoldersFromCache(item); } } }
public void should_process_tree_via_pipeline() { // Arrange using (var pipelines = new PipelinesHandler()) { var options = ProcessIntegrationItemsOptions.DefaultOptions; options.Force = true; Item item = new ItemMock().AsConfigurationItem(); // Act SharepointProvider.ProcessTree(item, options); // Assert pipelines.ShouldReceiveCall <SynchronizeTreeArgs>(PipelineNames.SynchronizeTree, x => true); } }
public override bool ExecuteAction() { var args = IntegrationPipelinesRunner.CreateIntegrationItem(ID.NewID, this.SharepointItem, this.SynchContext, ProcessIntegrationItemsOptions.DefaultOptions, EventSender.Sitecore); if (args == null) { return(false); } if (this.options.Recursive && args.IntegrationItem != null && SharepointProvider.IsActiveIntegrationFolder(args.IntegrationItem)) { IntegrationPipelinesRunner.SynchronizeTree(this.options, new SynchContext(args.IntegrationItem)); } return(true); }
/// <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); } }
/// <summary>The process.</summary> /// <param name="args">The args.</param> public virtual void Process([NotNull] GetChildrenArgs args) { Assert.ArgumentNotNull(args, "args"); if (!IntegrationDisabler.CurrentValue) { if (SharepointProvider.IsActiveIntegrationConfigItem(args.Item) || SharepointProvider.IsActiveIntegrationFolder(args.Item)) { SharepointProvider.ProcessTree(args.Item, ProcessIntegrationItemsOptions.DefaultAsyncOptions); } } if (!args.Handled) { using (new IntegrationDisabler()) { args.Result = args.FallbackProvider.GetChildren(args.Item, args.SecurityCheck); args.Handled = true; } } }
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); } } } }