protected override void Created(CreateContentContext context, TPart instance) { if (OnCreated != null) { OnCreated(context, instance); } }
void IContentPartHandler.Created(CreateContentContext context, ContentPart part) { if (part is TPart) { Created(context, (TPart)part); } }
void IContentStorageFilter.Created(CreateContentContext context) { if (context.ContentItem.Is <TPart>()) { Created(context, context.ContentItem as TPart); } }
void IContentHandler.Created(CreateContentContext context) { foreach (var filter in Filters.OfType <IContentStorageFilter>()) { filter.Created(context); } Created(context); }
public override void Creating(CreateContentContext context) { var infosetPart = context.ContentItem.As<InfosetPart>(); if (infosetPart != null) { context.ContentItemRecord.Data = infosetPart.Infoset.Data; context.ContentItemVersionRecord.Data = infosetPart.VersionInfoset.Data; infosetPart.Infoset = context.ContentItemRecord.Infoset; infosetPart.VersionInfoset = context.ContentItemVersionRecord.Infoset; } }
protected override void Created(CreateContentContext context) { var socket = context.ContentItem.As<SocketsPart>(); if (socket!=null) { // TODO: But we perhaps don't need to do this since ConnectorCollection tracks removed and added objects, // ideally we can drop this and let everything happen at the end of transaction scope. // If updating, perform connector persistence socket.Sockets.AllSockets.Invoke(c=>{c.Connectors.Flush(_mechanics.Value);}, Logger); } base.Created(context); }
public override void Creating(CreateContentContext context) { var utcNow = _clock.UtcNow; context.ContentItem.CreatedUtc = utcNow; context.ContentItem.ModifiedUtc = utcNow; var httpContext = _httpContextAccessor.HttpContext; if (context.ContentItem.Owner == null && (httpContext?.User?.Identity?.IsAuthenticated ?? false)) { context.ContentItem.Owner = httpContext.User.Identity.Name; } }
private void SetCategory(CreateContentContext ctx, ProductPart part) { var settings = part.Settings.GetModel<ProductPartSettings>(); var category = settings.CategoryId; int categoryId; if (category == "0" || !int.TryParse(category, out categoryId)) return; var term = _taxonomyService.GetTerm(categoryId); // Store category in part part.Category = term.Name; // As well as in the termspart, to make use of the taxonomies _taxonomyService.UpdateTerms(part.ContentItem, new List<TermPart>{term}, Constants.CategoryTaxonomyName); }
protected override void Created(CreateContentContext context) { // At this point the UpdateEditor hasn't been invoked on the content item yet, // so we don't have access to all of the information we might need (such as Title). // We set a flag which we will check in the Updated method (which is invoked when UpdateEditor is invoked). _contentItemCreated = true; }
protected override void Created(CreateContentContext context) { TryInvokeEventHandler(context.ContentType, graphDescriptor => _graphEventHandler.Value.NodeAdded(graphDescriptor, context.ContentItem)); }
public void Creating(CreateContentContext context) { }
public void Created(CreateContentContext context) { TriggerIfGraph(context); }
void IContentHandler.Creating(CreateContentContext context) { }
protected void AssignCreatingDates(CreateContentContext context, CoeveryCommonPart part) { // assign default create/modified dates part.Container = context.ContentItem; var utcNow = _clock.UtcNow; part.CreatedUtc = utcNow; part.ModifiedUtc = utcNow; part.VersionCreatedUtc = utcNow; part.VersionModifiedUtc = utcNow; }
public virtual void Create(ContentItem contentItem, VersionOptions options) { if (contentItem.Number == 0) { contentItem.Number = 1; contentItem.Latest = true; contentItem.Published = true; } // Version may be specified if (options.VersionNumber != 0) { contentItem.Number = options.VersionNumber; } // Draft flag on create is required for explicitly-published content items if (options.IsDraft) { contentItem.Published = false; } // Build a context with the initialized instance to create var context = new CreateContentContext(contentItem); // invoke handlers to add information to persistent stores Handlers.Invoke(handler => handler.Creating(context), _logger); Handlers.Invoke(handler => handler.Created(context), _logger); if (options.IsPublished) { var publishContext = new PublishContentContext(contentItem, null); // invoke handlers to acquire state, or at least establish lazy loading callbacks Handlers.Invoke(handler => handler.Publishing(publishContext), _logger); // invoke handlers to acquire state, or at least establish lazy loading callbacks Handlers.Invoke(handler => handler.Published(publishContext), _logger); } _session.Save(contentItem); _contentManagerSession.Store(contentItem); }
public virtual void Created(CreateContentContext context) { }
protected virtual void Created(CreateContentContext context, TPart instance) { }
void CreateIndexingTask(CreateContentContext context, ContentPart part) { _indexingTaskManager.CreateUpdateIndexTask(context.ContentItem); }
public virtual void Create(ContentItem contentItem, VersionOptions options) { if (contentItem.VersionRecord == null) { // produce root record to determine the model id contentItem.VersionRecord = new ContentItemVersionRecord { Number = 1, Latest = true, Published = true }; } // add to the collection manually for the created case contentItem.VersionRecord.ContentType = contentItem.ContentType; // version may be specified if (options.VersionNumber != 0) { contentItem.VersionRecord.Number = options.VersionNumber; } // draft flag on create is required for explicitly-published content items if (options.IsDraft) { contentItem.VersionRecord.Published = false; } // build a context with the initialized instance to create var context = new CreateContentContext(contentItem); // invoke handlers to add information to persistent stores Handlers.Invoke(handler => handler.Creating(context), _logger); Handlers.Invoke(handler => handler.Created(context), _logger); if (options.IsPublished) { var publishContext = new PublishContentContext(contentItem, null); // invoke handlers to acquire state, or at least establish lazy loading callbacks Handlers.Invoke(handler => handler.Publishing(publishContext), _logger); // invoke handlers to acquire state, or at least establish lazy loading callbacks Handlers.Invoke(handler => handler.Published(publishContext), _logger); } _session.Save(contentItem.Record); contentItem.VersionRecord.ContentItemId = contentItem.Record.Id; _session.Save(contentItem.VersionRecord); _contentManagerSession.Store(contentItem); }
public void Create(ContentItem contentItem) { _contentItemRepository.Create(contentItem.Record); // build a context with the initialized instance to create var context = new CreateContentContext(contentItem); // invoke handlers to add information to persistent stores Handlers.Invoke(handler => handler.Creating(context), Logger); Handlers.Invoke(handler => handler.Created(context), Logger); }
protected override void Creating(CreateContentContext context) { base.Creating(context); }
protected virtual void Created(CreateContentContext context) { }
protected override void Created(CreateContentContext context) { base.Created(context); InvalidateCachesAfteMenuItemChanges(context); }
public virtual void Created(CreateContentContext context, TPart instance) { }
protected void AssignCreatingOwner(CreateContentContext context, CoeveryCommonPart part) { // and use the current user as Owner if (part.Record.OwnerId == 0) { part.Owner = _authenticationService.GetAuthenticatedUser(); } }