/// <summary> /// Process export operation. /// </summary> /// <param name="operation"> /// The operation. /// </param> public virtual void Export(ExportOperation operation) { LogHelper.Debug("Export operation:" + operation, this); switch (operation.Type) { case ExportOperationType.Update: var entity = this.Update(operation); this.UpdateOnSitecore(operation, entity); break; case ExportOperationType.Create: entity = this.Create(operation); this.UpdateOnSitecore(operation, entity); break; case ExportOperationType.Delete: this.Delete(operation); break; case ExportOperationType.Move: entity = this.Move(operation); this.UpdateOnSitecore(operation, entity); break; } }
public virtual void Add(ExportOperation operation) { if (!WaitFoProcessing) { ThreadPool.QueueUserWorkItem(this.ProcesQueue); WaitFoProcessing = true; } }
public override void Remove(ExportOperation operation) { Sync.EnterWriteLock(); try { ExportScope.Remove(operation); } finally { Sync.ExitWriteLock(); } }
public override void Add(ExportOperation operation) { Sync.EnterWriteLock(); try { ExportScope.RemoveAll(i => i.Item.ID == operation.Item.ID); ExportScope.Add(operation); base.Add(operation); } finally { Sync.ExitWriteLock(); } }
/// <summary> /// Updates media item on the Sitecore after update on service side. /// </summary> protected virtual void UpdateOnSitecore(ExportOperation operation, object entity) { IItemSynchronizer sync = MediaFrameworkContext.GetItemSynchronizer(entity); if (sync != null) { var args = new MediaSyncItemImportArgs { Entity = entity, Item = operation.Item, AccountItem = operation.AccountItem, Synchronizer = sync, SyncAllowActivity = SyncAllowActivity.UpdateItem | SyncAllowActivity.SyncReferences }; MediaSyncItemImportPipeline.Run(args); //sync.UpdateItem(entity, operation.AccountItem, operation.Item); //sync.SyncReferences(entity, operation.AccountItem, operation.Item); } }
public abstract void Remove(ExportOperation operation);
public static void Remove(ExportOperation operation) { Provider.Remove(operation); }
public static void Add(ExportOperation operation) { Provider.Add(operation); }
/// <summary> /// Updates a media element. /// </summary> protected abstract object Update(ExportOperation operation);
/// <summary> /// Deletes a media element. /// </summary> protected abstract void Delete(ExportOperation operation);
/// <summary> /// Move a media element. /// </summary> protected virtual object Move(ExportOperation operation) { return(null); }