示例#1
0
        protected bool ShouldExecuteProvider(ID itemId)
        {
            var item = SerializedDatabase.GetItem(itemId);

            if (item == null)
            {
                return(false);
            }

            var result = _filter.Includes(item);

            return(result.IsIncluded);
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }