public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { // TODO: Move to provider! // TODO: Use prefecthing like the old one? var result = Provider.GetItem(itemDefinition.ID.ToGuid()); if (result != null && result.FieldValues != null) { var versions = new VersionUriList(); var versionsList = new List <VersionUri>(); foreach (var fieldKey in result.FieldValues.Where(field => field.Version.HasValue && field.Language != null)) { if (versionsList.Any(ver => fieldKey.Matches(ver))) { continue; } var newVersionUri = new VersionUri(LanguageManager.GetLanguage(fieldKey.Language), new Version(fieldKey.Version.Value)); versionsList.Add(newVersionUri); } foreach (var version in versionsList) { versions.Add(version); } return(versions); } return(null); }
public virtual VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { // return null if not present Assert.ArgumentNotNull(itemDefinition, "itemDefinition"); if (DisableSerialization || DisableTransparentSync || itemDefinition == ItemDefinition.Empty) { return(null); } var versions = new VersionUriList(); var item = GetTargetFromId(itemDefinition.ID); if (item == null) { return(null); } foreach (var version in item.Versions) { versions.Add(Language.Parse(version.Language.Name), Sitecore.Data.Version.Parse(version.VersionNumber)); } return(versions); }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { if ((itemDefinition.ID != FieldIds.SystemContent.UcommerceProductsMultilistWithSearch) && (itemDefinition.ID != FieldIds.SystemContent.UcommerceCategoriesTreeList)) { return(null); } if (_versions == null) { lock (_lock) { if (_versions == null) { var languages = LanguageManager.GetLanguages(Factory.GetDatabase(SitecoreConstants.SitecoreCoreDatabaseName)).Distinct(); var versions = new VersionUriList(); foreach (var language in languages) { versions.Add(language, Version.First); } _versions = versions; } } } return(_versions); }
/// <summary> /// Get a list of all available versions in different languages. /// </summary> /// <param name="itemDefinition">Used to identify the particular item</param> /// <param name="context"></param> /// <returns></returns> public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { Item result = Items.FindOneById(itemDefinition.ID.ToGuid()); if (result != null && result.FieldValues != null) { VersionUriList versions = new VersionUriList(); var versionsList = new List <VersionUri>(); foreach (FieldValueId fieldValueId in result.FieldValues.Keys.Where(fv => fv.Version.HasValue && fv.Language != null)) { if (versionsList.Where(ver => fieldValueId.Matches(ver)).Count() == 0) { VersionUri newVersionUri = new VersionUri( Sitecore.Data.Managers.LanguageManager.GetLanguage(fieldValueId.Language), new Sitecore.Data.Version(fieldValueId.Version.Value)); versionsList.Add(newVersionUri); } } foreach (var version in versionsList) { versions.Add(version); } return(versions); } return(null); }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { var list = new List <VersionUri>(); var item = this.DataStorage.GetFakeItem(itemDefinition.ID); foreach (var field in item.Fields) { foreach (var fieldLang in field.Values) { var language = fieldLang.Key; foreach (var fieldVer in fieldLang.Value) { var version = fieldVer.Key; if (list.Any(l => l.Language.Name == language && l.Version.Number == version)) { continue; } list.Add(new VersionUri(Language.Parse(language), new Version(version))); } } } var versions = new VersionUriList(); foreach (var version in list) { versions.Add(version); } return(versions); }
/// <summary> /// Updates the context result with the given Version Uri List /// </summary> /// <param name="result"></param> /// <param name="context"></param> private static void UpdateContext(VersionUriList result, CallContext context) { if ((result != null) && (result.Count > 0)) { VersionUriList currentResult = context.CurrentResult as VersionUriList; context.CurrentResult = VersionUriList.Add(currentResult, result); } context.SetNextIndex(context.Index + 1); }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { if (Items.ContainsKey(itemDefinition.ID)) { VersionUriList versionUriList = new VersionUriList(); versionUriList.Add(LanguageManager.DefaultLanguage, Version.Parse(1)); return(versionUriList); } return(null); }
public virtual void Process(GetItemVersionsArgs args) { Assert.ArgumentNotNull(args, "args"); Assert.ArgumentNotNull(args.Context, "args.Context"); var list = new VersionUriList(); foreach (var language in args.Context.DataManager.Database.Languages) { list.Add(language, Sitecore.Data.Version.First); } args.VersionUriList = list; }
// If our repository implemented language versions, this is where you'd manage it. // Some Product Inventory Management (PIM) system can version, so we could manage // that here. For this demo, we're assuming the products we have are suitable for // every version. public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { if (this.canProcessItem(itemDefinition.ID)) { Trace.WriteLine(String.Format("GetItemVersions({0}, {1})", itemDefinition, context), "ProductDataProvider"); var versions = new VersionUriList(); versions.Add(Language.Current, Sitecore.Data.Version.First); context.Abort(); return(versions); } return(base.GetItemVersions(itemDefinition, context)); }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { if (this.CanProcessItem(itemDefinition.ID, context)) { var database = Factory.GetDatabase("master"); var versionUriList = new VersionUriList(); foreach (var language in LanguageManager.GetLanguages(database)) { versionUriList.Add(language, Sitecore.Data.Version.First); } context.Abort(); return(versionUriList); } return(base.GetItemVersions(itemDefinition, context)); }
public override VersionUriList GetItemVersions(ItemDefinition item, CallContext context) { if (CanProcessItem(item.ID)) { VersionUriList versions = new VersionUriList(); // Just a little hack versions.Add(Language.Current, Sitecore.Data.Version.First); context.Abort(); return(versions); } return(base.GetItemVersions(item, context)); }
public VersionUriList GetItemVersions() { if (_versions == null) { var languages = LanguageManager.GetLanguages(Factory.GetDatabase(SitecoreConstants.SitecoreMasterDatabaseName)).Distinct(); var versions = new VersionUriList(); foreach (var language in languages) { versions.Add(language, Version.First); } _versions = versions; } return(_versions); }
public override VersionUriList GetItemVersions(ItemDefinition item, CallContext context) { IDTableEntry[] idList = IDTable.GetKeys(ID_TABLE_PREFIX, item.ID); if (idList.Length > 0) { context.Abort(); VersionUriList versions = new VersionUriList(); LanguageCollection languages = Sitecore.Data.Managers.LanguageManager.GetLanguages(this.Database); foreach (Language language in languages) { versions.Add(language, new Sitecore.Data.Version(1)); } return(versions); } return(null); }
public VersionUriList GetItemVersions() { MakeSureWeAreReady(); if (_versions == null) { var languages = LanguageManager.GetLanguages(Factory.GetDatabase(SitecoreConstants.SitecoreMasterDatabaseName)).Distinct(); var versions = new VersionUriList(); foreach (var language in languages) { _log.Debug <TemplateDataProvider>("Adding language to list of versions: " + language.CultureInfo.Name); versions.Add(language, Version.First); } _versions = versions; } return(_versions); }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { var versions = new VersionUriList(); if (itemDefinition == ItemDefinition.Empty) { return(versions); } var database = GetDatabase(context); var syncItem = database.GetItem(itemDefinition.ID.ToString()); foreach (var syncVersion in syncItem.Versions) { versions.Add(Language.Parse(syncVersion.Language), Version.Parse(syncVersion.Version)); } return(versions); }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { Assert.ArgumentNotNull(itemDefinition, "itemDefinition"); if (itemDefinition == ItemDefinition.Empty) { return(null); } var versions = new VersionUriList(); var syncItem = SerializedDatabase.GetItem(itemDefinition.ID); foreach (var syncVersion in syncItem.Versions) { versions.Add(Language.Parse(syncVersion.Language), Version.Parse(syncVersion.Version)); } return(versions); }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition) { // TODO: change signature to create FieldList once per all data providers var list = new VersionUriList(); var item = DataSet.LanguageData.TryGetValue(itemDefinition.ID.Guid); if (item == null) { return(list); } foreach (var lang in item.Keys) { // in read-only data provider only single "1" version per language is supported list.Add(Language.Parse(lang), Data.Version.Parse(1)); } return(list); }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { var item = GetItem(itemDefinition.ID); if (item != null) { var versions = new VersionUriList(); foreach (var entry in item.Languages) { var versionList = new VersionList(); foreach (var v in entry.Versions) { versions.Add(new VersionUri(Language.Parse(entry.Language), Sitecore.Data.Version.Parse(v.Number))); } } context.Abort(); return(versions); } return(base.GetItemVersions(itemDefinition, context)); }
public VersionUriList GetItemVersiones([NotNull] ID itemID) { Assert.ArgumentNotNull(itemID, "itemID"); var item = this.GetItem(itemID); if (item == null) { return(null); } var versionUriList = new VersionUriList(); var versions = item.Fields.Versioned.SelectMany(lang => lang.Value.Select(ver => new VersionUri(Language.Parse(lang.Key), new Sitecore.Data.Version(ver.Key)))); foreach (var versionUri in versions) { versionUriList.Add(versionUri); } return(versionUriList); }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { Assert.ArgumentNotNull(itemDefinition, "itemDefinition"); Assert.ArgumentNotNull(context, "context"); if (context.CurrentResult != null) { return(null); } if (itemDefinition.ID == FolderId || ControllerType.GetAllNamespaces().ContainsKey(itemDefinition.ID.ToGuid()) || ControllerType.GetAllControllers().ContainsKey(itemDefinition.ID.ToGuid()) || ControllerAction.GetControllerAction(itemDefinition.ID) != null) { VersionUriList versionUriList = new VersionUriList(); foreach (Language language in LanguageManager.GetLanguages(Database)) { versionUriList.Add(language, Version.First); } return(versionUriList); } return(null); }
public VersionUriList GetItemVersions() { if (_versions == null) { lock (_lock) { if (_versions == null) { var languages = LanguageManager.GetLanguages(Factory.GetDatabase(SitecoreConstants.SitecoreMasterDatabaseName)).Distinct(); var versions = new VersionUriList(); foreach (var language in languages) { //_log.Log<ContentNodeDataProvider>("Adding language to list of versions: " + language.CultureInfo.Name); versions.Add(language, Version.First); } _versions = versions; } } } return(_versions); }
public override VersionUriList GetItemVersions([CanBeNull] ItemDefinition itemDefinition, [CanBeNull] CallContext context) { if (itemDefinition == null || context == null) { return(base.GetItemVersions(itemDefinition, context)); } var item = FindItem(itemDefinition.ID); if (item == null) { return(base.GetItemVersions(itemDefinition, context)); } var list = new VersionUriList(); var versionUris = item.Languages.SelectMany(y => y.Versions.Select(x => new VersionUri(Language.Parse(y.Language), new Sitecore.Data.Version(x.Number)))); foreach (var versionUri in versionUris) { list.Add(versionUri); } return(list); }
/// <summary> /// Get a list of all available versions in different languages. /// </summary> /// <param name="itemDefinition">Used to identify the particular item</param> /// <param name="context"></param> /// <returns></returns> public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { if (ItemsById.ContainsKey(itemDefinition.ID) && ItemsById[itemDefinition.ID].Versions != null) { var versionsList = new List <VersionUri>(); foreach (SyncVersion version in ItemsById[itemDefinition.ID].Versions) { var newVersionUri = new VersionUri( LanguageManager.GetLanguage(version.Language), new Version(version.Version)); versionsList.Add(newVersionUri); } var versions = new VersionUriList(); foreach (VersionUri version in versionsList) { versions.Add(version); } return(versions); } return(null); }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { Assert.ArgumentNotNull(itemDefinition, "itemDefinition"); if (itemDefinition == ItemDefinition.Empty) return null; var versions = new VersionUriList(); var syncItem = SerializedDatabase.GetItem(itemDefinition.ID); foreach (var syncVersion in syncItem.Versions) { versions.Add(Language.Parse(syncVersion.Language), Version.Parse(syncVersion.Version)); } return versions; }
public virtual VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { // return null if not present Assert.ArgumentNotNull(itemDefinition, "itemDefinition"); if (DisableSerialization || DisableTransparentSync || itemDefinition == ItemDefinition.Empty) return null; var versions = new VersionUriList(); var item = GetTargetFromId(itemDefinition.ID); if (item == null) return null; foreach (var version in item.Versions) { versions.Add(Language.Parse(version.Language.Name), Sitecore.Data.Version.Parse(version.VersionNumber)); } return versions; }
// This method must return first version for every language to make info appear in content editor. public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { if (CanProcessYouTubeItem(itemDefinition.ID, context)) { VersionUriList versionUriList = new VersionUriList(); foreach (var language in LanguageManager.GetLanguages(ContentDB)) { versionUriList.Add(language, Sitecore.Data.Version.First); } context.Abort(); return versionUriList; } return base.GetItemVersions(itemDefinition, context); }
/// <summary> /// Get a list of all available versions in different languages. /// </summary> /// <param name="itemDefinition">Used to identify the particular item</param> /// <param name="context"></param> /// <returns></returns> public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { if (ItemsById.ContainsKey(itemDefinition.ID) && ItemsById[itemDefinition.ID].Versions != null) { List<VersionUri> versionsList = new List<VersionUri>(); foreach (SyncVersion version in ItemsById[itemDefinition.ID].Versions) { VersionUri newVersionUri = new VersionUri( Sitecore.Data.Managers.LanguageManager.GetLanguage(version.Language), new Sitecore.Data.Version(version.Version)); versionsList.Add(newVersionUri); } VersionUriList versions = new VersionUriList(); foreach (VersionUri version in versionsList) { versions.Add(version); } return versions; } return null; }
public override Collections.VersionUriList GetItemVersions(Data.ItemDefinition itemDefinition, CallContext context) { XPathNavigator element = (XPathNavigator)courseCache[itemDefinition.ID];// CourseData.SelectSingleNode(string.Format("//course[@id='{0}']", itemDefinition.ID.ToString())); if (element != null) { context.Abort(); VersionUriList versions = new VersionUriList(); LanguageCollection languages = LanguageManager.GetLanguages(this.Database); foreach (Language language in languages) { versions.Add(language, new Sitecore.Data.Version(1)); } return versions; } return null; }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { var section = SectionTable.FirstOrDefault(x => x.SectionId == itemDefinition.ID); var field = FieldTable.FirstOrDefault(x=>x.FieldId == itemDefinition.ID); if (field != null || section != null) { //return in every available language var languages = context.DataManager.Database.GetLanguages(); if (languages == null) { return null; } var list = new VersionUriList(); foreach (Language language in languages) { list.Add(language, Version.First); } return list; } return base.GetItemVersions(itemDefinition, context); }
public VersionUriList GetItemVersiones([NotNull] ID itemID) { Assert.ArgumentNotNull(itemID, "itemID"); var item = this.GetItem(itemID); if (item == null) { return null; } var versionUriList = new VersionUriList(); var versions = item.Fields.Versioned.SelectMany(lang => lang.Value.Select(ver => new VersionUri(Language.Parse(lang.Key), new Sitecore.Data.Version(ver.Key)))); foreach (var versionUri in versions) { versionUriList.Add(versionUri); } return versionUriList; }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { // TODO: Move to provider! // TODO: Use prefecthing like the old one? var result = Provider.GetItem(itemDefinition.ID.ToGuid()); if (result != null && result.FieldValues != null) { var versions = new VersionUriList(); var versionsList = new List<VersionUri>(); foreach (var fieldKey in result.FieldValues.Where(field => field.Version.HasValue && field.Language != null)) { if (versionsList.Any(ver => fieldKey.Matches(ver))) { continue; } var newVersionUri = new VersionUri(LanguageManager.GetLanguage(fieldKey.Language), new Version(fieldKey.Version.Value)); versionsList.Add(newVersionUri); } foreach (var version in versionsList) { versions.Add(version); } return versions; } return null; }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { var list = new List<VersionUri>(); var versions = new VersionUriList(); var item = this.DataStorage().GetFakeItem(itemDefinition.ID); if (item == null) { return versions; } foreach (var field in item.Fields) { foreach (var fieldLang in field.Values) { var language = fieldLang.Key; foreach (var fieldVer in fieldLang.Value) { var version = fieldVer.Key; if (list.Any(l => l.Language.Name == language && l.Version.Number == version)) { continue; } list.Add(new VersionUri(Language.Parse(language), new Version(version))); } } } foreach (var version in list) { versions.Add(version); } return versions; }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { var versions = new VersionUriList(); if (itemDefinition == ItemDefinition.Empty) { return versions; } var database = GetDatabase(context); var syncItem = database.GetItem(itemDefinition.ID.ToString()); foreach (var syncVersion in syncItem.Versions) { versions.Add(Language.Parse(syncVersion.Language), Version.Parse(syncVersion.Version)); } return versions; }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { if (Items.ContainsKey(itemDefinition.ID)) { VersionUriList versionUriList = new VersionUriList(); versionUriList.Add(LanguageManager.DefaultLanguage, Version.Parse(1)); return versionUriList; } return null; }
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { Assert.ArgumentNotNull(itemDefinition, "itemDefinition"); Assert.ArgumentNotNull(context, "context"); if (GetSqlVersion(itemDefinition.ID, context, GetSqlProvider(Database)) != null) return null; if (itemDefinition.ID == FolderId || ControllerType.GetAllNamespaces().ContainsKey(itemDefinition.ID.ToGuid()) || ControllerType.GetAllControllers().ContainsKey(itemDefinition.ID.ToGuid()) || ControllerAction.GetControllerAction(itemDefinition.ID) != null) { VersionUriList versionUriList = new VersionUriList(); foreach (Language language in LanguageManager.GetLanguages(Database)) versionUriList.Add(language, Version.First); return versionUriList; } return null; }
// If our repository implemented language versions, this is where you'd manage it. // Some Product Inventory Management (PIM) system can version, so we could manage // that here. For this demo, we're assuming the products we have are suitable for // every version. public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { if (this.canProcessItem(itemDefinition.ID)) { Trace.WriteLine(String.Format("GetItemVersions({0}, {1})", itemDefinition, context), "ProductDataProvider"); var versions = new VersionUriList(); versions.Add(Language.Current, Sitecore.Data.Version.First); context.Abort(); return versions; } return base.GetItemVersions(itemDefinition, context); }
public override VersionUriList GetItemVersions([CanBeNull] ItemDefinition itemDefinition, [CanBeNull] CallContext context) { if (itemDefinition == null || context == null) { return base.GetItemVersions(itemDefinition, context); } var item = FindItem(itemDefinition.ID); if (item == null) { return base.GetItemVersions(itemDefinition, context); } var list = new VersionUriList(); var versionUris = item.Languages.SelectMany(y => y.Versions.Select(x => new VersionUri(Language.Parse(y.Language), new Sitecore.Data.Version(x.Number)))); foreach (var versionUri in versionUris) { list.Add(versionUri); } return list; }
public VersionUriList GetItemVersions(ID itemID) { Assert.ArgumentNotNull(itemID, nameof(itemID)); var item = this.GetItem(itemID); if (item == null) { return null; } var versionUriList = new VersionUriList(); Lock.EnterReadLock(); try { foreach (var lang in item.Fields.Versioned) { var language = Language.Parse(lang.Key); var versions = lang.Value; foreach (var versionNumber in versions.Keys) { var version = new Sitecore.Data.Version(versionNumber); var versionUri = new VersionUri(language, version); versionUriList.Add(versionUri); } } } finally { Lock.ExitReadLock(); } return versionUriList; }
/// <summary> /// Get a list of all available versions in different languages. /// </summary> /// <param name="itemDefinition">Used to identify the particular item</param> /// <param name="context"></param> /// <returns></returns> public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context) { Item result = Items.FindOneById(itemDefinition.ID.ToGuid()); if (result != null && result.FieldValues != null) { VersionUriList versions = new VersionUriList(); var versionsList = new List<VersionUri>(); foreach (FieldValueId fieldValueId in result.FieldValues.Keys.Where(fv => fv.Version.HasValue && fv.Language != null)) { if (versionsList.Where(ver => fieldValueId.Matches(ver)).Count() == 0) { VersionUri newVersionUri = new VersionUri( Sitecore.Data.Managers.LanguageManager.GetLanguage(fieldValueId.Language), new Sitecore.Data.Version(fieldValueId.Version.Value)); versionsList.Add(newVersionUri); } } foreach (var version in versionsList) { versions.Add(version); } return versions; } return null; }