/// <summary>
        /// Method for Creating Bucket
        /// </summary>
        /// <param name="parameters">
        /// The parameters.
        /// </param>
        private void StartProcess(params object[] parameters)
        {
            var contextItem = (Item)parameters[0];

            BucketManager.CreateBucket(contextItem);
            using (new EditContext(contextItem, SecurityCheck.Disable))
            {
                if (!contextItem.IsBucketItemCheck())
                {
                    contextItem.IsBucketItemCheckBox().Checked = true;
                }

                if (contextItem.HasChildren)
                {
                    Parallel.ForEach(contextItem.GetChildren(), (child, state, i) =>
                    {
                        using (new EditContext(child, SecurityCheck.Disable))
                        {
                            if (child.TemplateID == Util.Config.ContainerTemplateId)
                            {
                                child.Appearance.Hidden = true;
                            }
                        }
                    });
                }

                Event.RaiseEvent("item:bucketing:ended", parameters, this);
                Log.Info("Created Bucket Item for " + contextItem.ID, this);
            }
        }
        public void CreateBucketTest()
        {
            Config        config        = new Config();
            Mac           mac           = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            // 填写存储区域代号   z0:华东  z1:华北 z2:华南  na0:北美
            // Region = "z0"
            HttpResult ret = bucketManager.CreateBucket(Bucket, Region);

            if (ret.Code != (int)HttpCode.OK)
            {
                Assert.Fail("create bucket error: " + ret.ToString());
            }
            Console.WriteLine(ret.ToString());
        }
            public void GetItem()
            {
                Database database = global::Sitecore.Configuration.Factory.GetDatabase("master");

                Assert.IsNotNull(database);

                Item item = database.GetItem("/sitecore/content");

                using (new BucketImportContext(item))
                {
                    //Disable History Engine
                    //Disable Publishing Queue
                    //Smart Links Database Rebuild

                    BucketManager.CreateBucket(item, (itm => BucketManager.AddSearchTabToItem(item)));
                }
                Assert.IsNotNull(item);
                Assert.AreEqual("content", item.Name);
            }
Example #4
0
        private void StartProcess(params object[] parameters)
        {
            var contextItem = (Item)parameters[0];

            BucketManager.CreateBucket(contextItem);
            using (new EditContext(contextItem, SecurityCheck.Disable))
            {
                if (Context.Job.IsNotNull())
                {
                    Context.Job.Status.Messages.Add("Syncing " + contextItem.Paths.FullPath + " item");
                }
                if (!contextItem.IsBucketItemCheck())
                {
                    contextItem.IsBucketItemCheckBox().Checked = true;
                }

                Log.Info("Syncronisation Run on " + contextItem.ID + " bucket", this);
            }
        }
Example #5
0
        private Item RunCreationOfItemsTest()
        {
            var itemToReturn = Factory.GetDatabase("master").GetItem("{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}").Add("Test Stub",
                                                                                                                   new TemplateID(
                                                                                                                       TemplateIDs.
                                                                                                                       Folder));

            for (int i = 0; i < 10; i++)
            {
                var currItem = ItemManager.CreateItem("Tim " + DateTime.Now.ToLongTimeString(), itemToReturn,
                                                      new ID("{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}"));
                currItem.Editing.BeginEdit();
                currItem.Versions.AddVersion();
                currItem.Fields["Title"].Value = "Tim";
                currItem.Editing.EndEdit();
            }

            BucketManager.CreateBucket(itemToReturn);
            return(itemToReturn);
        }
        public static void RunCreationOfItemsTest()
        {
            using (new BulkUpdateContext())
            {
                BucketManager.CreateBucket(Sitecore.Context.ContentDatabase.GetItem("{44D7C0DC-0151-45D8-BAF5-45EB82B24C5A}"));

                for (int i = 0; i < 10; i++)
                {
                    var currItem = ItemManager.CreateItem(DateTime.Now.ToLongTimeString(),
                                                          Sitecore.Context.ContentDatabase.GetItem(
                                                              "{44D7C0DC-0151-45D8-BAF5-45EB82B24C5A}"),
                                                          new ID("{8B046BC6-4AAF-4652-A1B7-06A6199AEDCE}"));
                    currItem.Editing.BeginEdit();
                    currItem.Versions.AddVersion();
                    currItem.Fields["Title"].Value = "hfosf";
                    currItem.Editing.EndEdit();
                }

                BucketManager.CreateBucket(Sitecore.Context.ContentDatabase.GetItem("{44D7C0DC-0151-45D8-BAF5-45EB82B24C5A}"));
            }
        }