protected override void DoProcess(CustomSerializationPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.IsNotNull(args.Item, "no item was passed to the pipeline");

            FileInfo itemFileInfo = GetItemFileInfo(GetIndexFileInfo(args.Item.Database.Name).Directory, args.Item.ID.ToGuid());

            if (!itemFileInfo.Exists)
            {
                args.AddMessage(
                    string.Format("File '{0}' could not be found; item loading aborted", itemFileInfo.FullName),
                    PipelineMessageType.Error);
                args.AbortPipeline();
                return;
            }

            ItemFile itemFile = args.SerializationManager.ReadItemFile(itemFileInfo);

            if (this.revert)
            {
                args.Item = args.SerializationManager.DeleteAndRecreate(itemFile, args.Item);
            }

            args.SerializationManager.LoadItemIntoSitecore(itemFile, args.Item, revert);
        }
Example #2
0
        protected override void DoProcess(CustomSerializationPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.IsNotNull(args.IndexFile, "no index file was passed");
            Assert.IsNotNull(args.Item, "no item was passed to the pipeline");

            args.SerializationManager.UpdateIndexFile(args.IndexFile, args.Item, this.recurseAllDescendants);
        }
Example #3
0
        protected override void DoProcess(CustomSerializationPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.IsNotNull(args.Item, "no item was passed to the pipeline");

            DirectoryInfo indexFileDirectory = GetIndexFileInfo(args.Item.Database.Name).Directory;

            UpdateItem(args.SerializationManager, indexFileDirectory, args.Item, recurseAllDescendants);
        }
        protected override void DoProcess(CustomSerializationPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.IsNotNull(args.IndexFile, "no index file was passed");
            Assert.IsNotNull(args.Item, "no item was passed to the pipeline");

            FileInfo indexFile = GetIndexFileInfo(args.Item.Database.Name);

            indexFile.Directory.Create();

            File.WriteAllText(indexFile.FullName, JsonConvert.SerializeObject(args.IndexFile, Formatting.Indented));
        }
Example #5
0
        protected override void DoProcess(CustomSerializationPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.IsNotNull(args.IndexFile, "No IndexFile found; needed for determining item tree structure");

            IndexFileItem indexFileItem = args.IndexFile.GetDescendantOrSelf(args.Item.ID.ToGuid());

            Assert.IsNotNull(indexFileItem, string.Format("Could not find item with ID {0} in serialized data", args.Item.ID));

            DirectoryInfo parentDirectory = GetIndexFileInfo(args.Item.Database.Name).Directory;

            SerializationManager serializationManager = new SerializationManager();

            CorePipeline.Run(revert ? "serialization.revertitem" : "serialization.loaditem",
                             new CustomSerializationPipelineArgs()
            {
                SerializationManager = serializationManager,
                Item = args.Item
            });
            LoadDescendants(indexFileItem, args.Item, serializationManager, parentDirectory);
        }
        protected override void DoProcess(CustomSerializationPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.IsNotNull(args.Item, "no item was passed to the pipeline");

            FileInfo indexFile = GetIndexFileInfo(args.Item.Database.Name);

            if (!indexFile.Exists)
            {
                args.IndexFile = new IndexFileItem()
                {
                    Id = ItemIDs.RootID.ToGuid()
                };
            }
            else
            {
                using (StreamReader indexFileStream = File.OpenText(indexFile.FullName))
                {
                    args.IndexFile = new JsonSerializer().Deserialize <IndexFileItem>(new JsonTextReader(indexFileStream));
                }
            }
        }