public void RemoveID(string prefix, ID id) { var key = new IdTableIdKey(prefix, id.Guid); if (_idById.ContainsKey(key)) { _idById.Remove(key); } IDTable.RemoveID(prefix, id); }
private static IDTableEntry UpdateOrCreateIDTableEntry(string prefix, string key, ID id, ID parentId, string customData) { var keys = IDTable.GetKeys(prefix, id); if (keys != null && keys.Length > 0) { var entry = keys[0]; if (entry.ParentID == parentId && string.Equals(entry.CustomData, customData)) { return(entry); } IDTable.RemoveID(prefix, id); } return(IDTable.Add(prefix, key, id, parentId, customData)); }
public void RunJob(string idTablePrefix, ID itemId) { var db = Database.GetDatabase("master"); var item = db.GetItem(itemId); if (item != null) { item.Editing.BeginEdit(); using (new EditContext(item)) { item.Delete(); } item.Editing.EndEdit(); } IDTable.RemoveID(idTablePrefix, itemId); }
public override ItemDefinition GetItemDefinition(ID itemId, CallContext context) { IDTableEntry[] idList = IDTable.GetKeys(ID_TABLE_PREFIX, itemId); if (idList.Length > 0) { IDTableEntry mappedID = idList[0]; context.Abort(); XmlNode video = VideoData.SelectSingleNode("/response/videos/video[@key='" + mappedID.Key + "']"); if (video == null) { IDTable.RemoveID(ID_TABLE_PREFIX, mappedID.ID); return(null); } ItemDefinition videoItem = new ItemDefinition(itemId, mappedID.Key, ID.Parse(TEMPLATE), ID.Null); return(videoItem); } return(base.GetItemDefinition(itemId, context)); }
protected void OnItemDeleted(object sender, System.EventArgs args) { if (args != null) { Item item = Event.ExtractParameter(args, 0) as Item; Assert.IsNotNull(item, "No item in parameters"); ID parentID = item.ParentID; if (BucketManager.IsItemContainedWithinBucket(item)) { parentID = item.GetParentBucketItemOrParent().ParentID; } //IHasExternalId i = item.GlassCast<IHasExternalId>(); string extId = item[IHasExternalIdConstants.ExternalIdFieldId]; if (!string.IsNullOrEmpty(extId)) { string prefix = item.TemplateID.Guid.GetMatchingPrefix(); IDTable.RemoveID(prefix, item.ID); } else if (parentID.Equals(RebootConstants.ImageRootID)) { IDTable.RemoveID(RebootConstants.ImageItemPrefix, item.ID); } } }
public void RemoveID(string prefix, ID id) { IDTable.RemoveID(prefix, id); }