private static SynchContext CreateSyncContext() { var item = PrepareDbWithItemTree(); IntegrationCache.AddIntegrationConfigData(item.ID, new IntegrationConfigData("server", "list", "templateID"), 0); return(new SynchContext(item)); }
public static ItemMock PutConfigDataToCache(this ItemMock item, IntegrationConfigData configData = null) { IntegrationCache.AddIntegrationConfigData( item.ID, configData ?? new IntegrationConfigData("server", "list", "templateID"), 60); return(item); }
private SynchContext CreateSynchContext(IntegrationConfigData integrationConfigData) { var id = ID.NewID; IntegrationCache.AddIntegrationConfigData(id, integrationConfigData, 0); var synchContext = new SynchContext(id, Substitute.For <Database>()); return(synchContext); }
protected virtual void ProcessTree([NotNull] ProcessIntegrationItemsOptions processIntegrationItemsOptions, [NotNull] SynchContext synchContext) { Assert.ArgumentNotNull(processIntegrationItemsOptions, "processIntegrationItemsOptions"); Assert.ArgumentNotNull(synchContext, "synchContext"); IntegrationCache.AddIntegrationConfigData(synchContext.ParentID, synchContext.IntegrationConfigData, (synchContext.IntegrationConfigData.ExpirationInterval > 0) ? synchContext.IntegrationConfigData.ExpirationInterval : DefaultTimeout); // IDList existenChildrenList = new IDList(); // foreach (Item it in SynchContext.ParentItem.GetChildren()) // { // existenChildrenList.Add(it.ID); // } IDList existenChildrenList = synchContext.Database.DataManager.DataSource.GetChildIDs(synchContext.ParentID); var existenList = new List <ID>(existenChildrenList.Cast <ID>()); foreach (SharepointBaseItem listItem in this.GetSubItems(this.GetList(synchContext.IntegrationConfigData), synchContext.IntegrationConfigData)) { ID id = Utils.GetID(synchContext.ParentID.ToString(), listItem.UniqueID); bool itemExist = existenList.IndexOf(id) != -1; if (Switcher <bool, SynchDisabler> .CurrentValue == false) { if (itemExist) { if (IsActiveIntegrationDataItem(id, synchContext.Database)) { IntegrationPipelinesRunner.UpdateIntegrationItem(id, listItem, synchContext, processIntegrationItemsOptions, EventSender.Sharepoint); } existenChildrenList.Remove(id); } else { IntegrationPipelinesRunner.CreateIntegrationItem(id, listItem, synchContext, processIntegrationItemsOptions, EventSender.Sharepoint); } } if (listItem is FolderItem) { if (IsActiveIntegrationDataItem(id, synchContext.Database)) { var newSynchContext = new SynchContext(id, synchContext.Database); if (processIntegrationItemsOptions.Recursive) { ProcessTree(processIntegrationItemsOptions, newSynchContext); } } } IntegrationCache.AddIntegrationItemInfo(id, listItem, synchContext.ParentID, (synchContext.IntegrationConfigData.ExpirationInterval > 0) ? synchContext.IntegrationConfigData.ExpirationInterval : DefaultTimeout); } if (Switcher <bool, SynchDisabler> .CurrentValue == false) { foreach (ID id in existenChildrenList) { if (IsActiveIntegrationDataItem(id, synchContext.Database)) { IntegrationPipelinesRunner.DeleteIntegrationItem(id, synchContext); } } } }
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); }