public XElement Export(ContentItem contentItem) { var context = new ExportContentContext(contentItem, new XElement(XmlConvert.EncodeLocalName(contentItem.ContentType))); foreach (var contentHandler in Handlers) { contentHandler.Exporting(context); } foreach (var contentHandler in Handlers) { contentHandler.Exported(context); } if (context.Exclude) { return(null); } context.Data.SetAttributeValue("Id", GetItemMetadata(contentItem).Identity.ToString()); if (contentItem.IsPublished()) { context.Data.SetAttributeValue("Status", Published); } else { context.Data.SetAttributeValue("Status", Draft); } return(context.Data); }
/// <summary> /// Creates a IDocumentIndex instance for a specific content item id. If the content /// item is no more published, it returns null. /// </summary> private IDocumentIndex ExtractDocumentIndex(ContentItem contentItem) { // ignore deleted or unpublished items if (contentItem == null || (!contentItem.IsPublished() && !contentItem.HasDraft())) { return null; } var documentIndex = _indexProvider.New(contentItem.Id); // call all handlers to add content to index _contentManager.Index(contentItem, documentIndex); return documentIndex; }
/// <summary> /// Creates a IDocumentIndex instance for a specific content item id. If the content /// item is no more published, it returns null. /// </summary> private IDocumentIndex ExtractDocumentIndex(ContentItem contentItem) { // ignore deleted or unpublished items if (contentItem == null || !contentItem.IsPublished()) { return null; } // skip items from types which are not indexed var settings = GetTypeIndexingSettings(contentItem); if (!settings.Included) { return null; } var documentIndex = _indexProvider.New(contentItem.Id); // call all handlers to add content to index _contentManager.Index(contentItem, documentIndex); return documentIndex; }