protected bool ShouldExecuteProvider(ID itemId) { var item = SerializedDatabase.GetItem(itemId); if (item == null) { return(false); } var result = _filter.Includes(item); return(result.IsIncluded); }
public override ID ResolvePath(string itemPath, CallContext context) { Assert.ArgumentNotNull(itemPath, "itemPath"); var existingPath = SerializedDatabase.GetItem(itemPath); if (existingPath == null) { return(null); } if (!ShouldExecuteProvider(existingPath.GetSitecoreId())) { return(null); } context.Abort(); return(base.ResolvePath(itemPath, context)); }
public override bool CopyItem(ItemDefinition source, ItemDefinition destination, string copyName, ID copyId, CallContext context) { Assert.ArgumentNotNull(source, "source"); Assert.ArgumentNotNull(destination, "destination"); Assert.ArgumentNotNullOrEmpty(copyName, "copyName"); Assert.ArgumentNotNull(copyId, "copyId"); // we use the Database API instead of our own so we can get a source item from any data provider var existingItem = Database.GetItem(source.ID); Assert.IsNotNull(existingItem, "Could not copy {0} because it did not exist!", source.ID); var destinationItem = _database.GetItem(destination.ID); Assert.IsNotNull(destinationItem, "Source item to copy {0} was in the Rhino provider but the destination parent {1} was not. Copying from Rhino to other providers is not supported.", source.Name, destination.Name); SerializedDatabase.CopyItem(ItemSynchronization.BuildSyncItem(existingItem), destination.ID, copyName, copyId); return(true); }