public VersionManager(ContentVersionRepository versionRepository, IContentItemRepository itemRepository, StateChanger stateChanger, EditSection config) { this.Repository = versionRepository; this.itemRepository = itemRepository; this.stateChanger = stateChanger; maximumVersionsPerItem = config.Versions.MaximumPerItem; }
public override void SetUp() { base.SetUp(); var types = new[] { typeof(Items.PageItem), typeof(Items.DataItem) }; versionRepository = TestSupport.CreateVersionRepository(types); var versions = TestSupport.SetupVersionManager(persister, versionRepository); //definitions = TestSupport.SetupDefinitions(types); ITemplateAggregator templates; ContentActivator activator; TestSupport.Setup(out definitions, out templates, out activator, types); creator = new CreateUrlProvider( persister, new EditUrlManager(null, new EditSection()), definitions, templates, activator, new Navigator(persister, TestSupport.SetupHost(), new VirtualNodeFactory(), TestSupport.SetupContentSource()), versions, versionRepository); request = new NameValueCollection(); root = CreateOneItem<Items.PageItem>(0, "root", null); }
public ContentVersionCleanup(IItemNotifier notifier, ContentVersionRepository repository) { this.notifier = notifier; this.repository = repository; }
public VersionAjaxService(Navigator navigator, ContentVersionRepository versionRepository, IWebContext webContext, ISecurityManager security) { _navigator = navigator; _versionRepository = versionRepository; _security = security; _webContext = webContext; }
public ItemMover(IPersister persister, Navigator navigator, IIntegrityManager integrity, IVersionManager versions, ContentVersionRepository versionRepository) { this.persister = persister; this.navigator = navigator; this.integrity = integrity; this.versions = versions; this.versionRepository = versionRepository; }
public override void SetUp() { base.SetUp(); persister = null; activator = null; repository = TestSupport.CreateVersionRepository(ref persister, ref activator, typeof(Items.NormalPage), typeof(Items.NormalItem)); drafts = new DraftRepository(repository, new FakeCacheWrapper()); }
public PublishScheduledAction(ContentVersionRepository versionRepository, IVersionManager versioner, IPersister persister, ISecurityManager security, StateChanger changer) { this.versionRepository = versionRepository; this.versioner = versioner; this.persister = persister; this.security = security; this.changer = changer; }
protected PartsModifyingAjaxService(Navigator navigator, IIntegrityManager integrity, IVersionManager versions, ContentVersionRepository versionRepository, IDefinitionManager definitionManager) { this.navigator = navigator; this.integrity = integrity; this.versions = versions; this.versionRepository = versionRepository; this.definitionManager = definitionManager; }
public CreateUrlProvider(IPersister persister, IEditUrlManager editUrlManager, IDefinitionManager definitions, ContentActivator activator, Navigator navigator, IVersionManager versions, ContentVersionRepository versionRepository) { this.persister = persister; this.managementPaths = editUrlManager; this.definitions = definitions; this.activator = activator; this.navigator = navigator; this.versions = versions; this.versionRepository = versionRepository; }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); Security = Engine.SecurityManager; Definitions = Engine.Definitions; Versions = Engine.Resolve<IVersionManager>(); Commands = Engine.Resolve<CommandDispatcher>(); EditManager = Engine.EditManager; ManagementPaths = Engine.ManagementPaths; Repository = Engine.Resolve<ContentVersionRepository>(); }
public static VersionInfo GetVersionInfo(this ContentVersion version, ContentVersionRepository repository) { try { return(new VersionInfo { ID = version.Master.ID.Value, ContentFactory = () => repository.DeserializeVersion(version), Expires = version.Expired, Published = version.Published, FuturePublish = version.FuturePublish, SavedBy = version.SavedBy, State = version.State, Title = version.Title, VersionIndex = version.VersionIndex, PartsCount = version.ItemCount - 1 }); } catch (Exception ex) { var iv = new InvalidVersionInfo(); if (version != null) { iv.InnerException = ex; iv.Expires = version.Expired; iv.Published = version.Published; iv.FuturePublish = version.FuturePublish; iv.SavedBy = version.SavedBy; iv.State = version.State; iv.Title = version.Title; iv.VersionIndex = version.VersionIndex; iv.PartsCount = version.ItemCount - 1; if (version.Master.ID != null) { iv.ID = version.Master.ID.Value; } else { Logger.Error("version.Master.ID is null at VersionInfo::GetVersionInfo(...)"); } } else { Logger.Error("version == null at VersionInfo::GetVersionInfo(...)"); } return(iv); } }
public static VersionInfo GetVersionInfo(this ContentVersion version, ContentVersionRepository repository) { return(new VersionInfo { ID = version.Master.ID.Value, ContentFactory = () => repository.DeserializeVersion(version), Expires = version.Expired, Published = version.Published, FuturePublish = version.FuturePublish, SavedBy = version.SavedBy, State = version.State, Title = version.Title, VersionIndex = version.VersionIndex }); }
public override void SetUp() { base.SetUp(); repository = TestSupport.CreateVersionRepository(ref persister, ref activator, typeof(NormalPage), typeof(NormalItem)); master = CreateOneItem<NormalPage>(0, "root", null); persister.Save(master); version = CreateOneItem<NormalPage>(0, "root version", null); version.State = ContentState.Unpublished; version.VersionOf = master; version.VersionIndex = master.VersionIndex + 1; version.SavedBy = "test"; persister.Save(master); worker = new UpgradeVersionWorker(repository, persister.Repository); }
public override void SetUp() { base.SetUp(); var types = new[] { typeof(Items.PageItem), typeof(Items.DataItem) }; versionRepository = TestSupport.CreateVersionRepository(ref persister, ref activator, types); versions = TestSupport.SetupVersionManager(persister, versionRepository); copyer = new ItemCopyer( // persister, new Navigator(persister, TestSupport.SetupHost(), new VirtualNodeFactory(), TestSupport.SetupContentSource()), new FakeIntegrityManager(), versions, versionRepository); request = new NameValueCollection(); root = CreateOneItem<Items.PageItem>(0, "root", null); }
public static VersionInfo GetVersionInfo(this ContentVersion version, ContentVersionRepository repository) { try { return new VersionInfo { ID = version.Master.ID.Value, ContentFactory = () => repository.DeserializeVersion(version), Expires = version.Expired, Published = version.Published, FuturePublish = version.FuturePublish, SavedBy = version.SavedBy, State = version.State, Title = version.Title, VersionIndex = version.VersionIndex, PartsCount = version.ItemCount - 1 }; } catch (Exception ex) { var iv = new InvalidVersionInfo(); if (version != null) { iv.InnerException = ex; iv.Expires = version.Expired; iv.Published = version.Published; iv.FuturePublish = version.FuturePublish; iv.SavedBy = version.SavedBy; iv.State = version.State; iv.Title = version.Title; iv.VersionIndex = version.VersionIndex; iv.PartsCount = version.ItemCount - 1; if (version.Master.ID != null) iv.ID = version.Master.ID.Value; else Logger.Error("version.Master.ID is null at VersionInfo::GetVersionInfo(...)"); } else { Logger.Error("version == null at VersionInfo::GetVersionInfo(...)"); } return iv; } }
public void TestFixtureSetUp() { var definitionProviders = TestSupport.SetupDefinitionProviders(new DefinitionMap(), typeof(NormalPage), typeof(NormalItem)); var proxies = new N2.Persistence.Proxying.InterceptingProxyFactory(); proxies.Initialize(definitionProviders.SelectMany(dp => dp.GetDefinitions())); itemRepository = new MongoContentItemRepository( databaseProvider = new MongoDatabaseProvider(TestSupport.CreateDependencyInjector(), proxies, new N2.Configuration.ConfigurationManagerWrapper("n2mongo"), definitionProviders, new AdaptiveContext())); persister = new ContentPersister(TestSupport.SetupContentSource(itemRepository), itemRepository); IRepository<ContentVersion> versionRepository = new MongoDbRepository<ContentVersion>(databaseProvider); repository = TestSupport.CreateVersionRepository( ref persister, ref activator, ref versionRepository, typeof(NormalPage), typeof(NormalItem)); drafts = new DraftRepository(repository, new FakeCacheWrapper()); }
public DraftRepository(ContentVersionRepository repository, CacheWrapper cache) { this.Versions = repository; this.cache = cache; }
public UpgradeVersionWorker(ContentVersionRepository versionRepository, IContentItemRepository itemRepository) { this.versionRepository = versionRepository; this.itemRepository = itemRepository; }
public static ContentItem GetVersionItem(this ContentVersionRepository repository, ContentItem item, int versionIndex) { var version = repository.GetVersion(item, versionIndex); return(repository.DeserializeVersion(version)); }
// find item (and optional version) from request values (compare WebExtension.GetEditableWrapper) public static ContentItem FindItem(IVersionManager versions, ContentVersionRepository versionRepository, Navigator navigator, NameValueCollection request) { var item = navigator.Navigate(request[PathData.ItemQueryKey]); return versionRepository.ParseVersion(request[PathData.VersionIndexQueryKey], request[PathData.VersionKeyQueryKey], item) ?? item; }
public ItemUpdater(Navigator navigator, IIntegrityManager integrity, IVersionManager versions, ContentVersionRepository versionRepository, IDefinitionManager definitionManager = null) : base(navigator, integrity, versions, versionRepository, definitionManager) { }
public static VersionInfo GetVersionInfo(this ContentVersion version, ContentVersionRepository repository) { return new VersionInfo { ID = version.Master.ID.Value, ContentFactory = () => repository.DeserializeVersion(version), Expires = version.Expired, Published = version.Published, FuturePublish = version.FuturePublish, SavedBy = version.SavedBy, State = version.State, Title = version.Title, VersionIndex = version.VersionIndex }; }