protected override ApiController CreateController(Type controllerType, HttpRequestMessage msg, UmbracoHelper helper, ITypedPublishedContentQuery qry, ServiceContext serviceContext, BaseSearchProvider searchProvider) { _onServicesCreated(msg, helper.UmbracoContext, qry, serviceContext, searchProvider); //Create the controller with all dependencies var ctor = controllerType.GetConstructor(new[] { typeof(UmbracoContext), typeof(UmbracoHelper), typeof(BaseSearchProvider) }); if (ctor == null) { throw new MethodAccessException("Could not find the required constructor for the controller"); } var created = (ApiController)ctor.Invoke(new object[] { //ctor args helper.UmbracoContext, helper, searchProvider }); return created; }
public PageScoreNodeHelper(ITypedPublishedContentQuery typedPublishedContentQuery, INodeReportRepository nodeReportRepository, IPageScoreSerializer pageScoreSerializer, IAnalyzeService analyzeService) { if (typedPublishedContentQuery == null) { throw new ArgumentNullException(nameof(typedPublishedContentQuery)); } if (nodeReportRepository == null) { throw new ArgumentNullException(nameof(nodeReportRepository)); } if (pageScoreSerializer == null) { throw new ArgumentNullException(nameof(pageScoreSerializer)); } if (analyzeService == null) { throw new ArgumentNullException(nameof(analyzeService)); } _typedPublishedContentQuery = typedPublishedContentQuery; _nodeReportRepository = nodeReportRepository; _pagescoreSerializer = pageScoreSerializer; _analyzeService = analyzeService; }
public TestServices(HttpRequestMessage httpRequestMessage, UmbracoContext umbracoContext, ITypedPublishedContentQuery publishedContentQuery, ServiceContext serviceContext, BaseSearchProvider searchProvider, IUmbracoSettingsSection umbracoSettings) { HttpRequestMessage = httpRequestMessage; UmbracoContext = umbracoContext; PublishedContentQuery = publishedContentQuery; ServiceContext = serviceContext; SearchProvider = searchProvider; UmbracoSettings = umbracoSettings; }
/// <summary> /// Returns the Umbraco page id to use as the Not Found page based on the configured 404 pages and the current request /// </summary> /// <param name="error404Collection"></param> /// <param name="requestServerName"> /// The server name attached to the request, normally would be the source of HttpContext.Current.Request.ServerVariables["SERVER_NAME"] /// </param> /// <param name="entityService"></param> /// <param name="publishedContentQuery"></param> /// <param name="domainService"></param> /// <returns></returns> internal static int?GetCurrentNotFoundPageId( IContentErrorPage[] error404Collection, string requestServerName, IEntityService entityService, ITypedPublishedContentQuery publishedContentQuery, IDomainService domainService) { throw new NotImplementedException(); }
/// <summary> /// Gets a content item from the cache /// </summary> /// <param name="contentQuery"></param> /// <param name="id"></param> /// <returns></returns> public static IPublishedContent TypedContent(this ITypedPublishedContentQuery contentQuery, Udi id) { var guidUdi = id as GuidUdi; if (guidUdi == null) { throw new InvalidOperationException("UDIs for content items must be " + typeof(GuidUdi)); } return(contentQuery.TypedContent(guidUdi.Guid)); }
/// <summary> /// Constructor used to wrap the ITypedPublishedContentQuery and IDynamicPublishedContentQuery objects passed in /// </summary> /// <param name="typedContentQuery"></param> /// <param name="dynamicContentQuery"></param> public PublishedContentQuery(ITypedPublishedContentQuery typedContentQuery, IDynamicPublishedContentQuery dynamicContentQuery) { if (typedContentQuery == null) { throw new ArgumentNullException("typedContentQuery"); } if (dynamicContentQuery == null) { throw new ArgumentNullException("dynamicContentQuery"); } _typedContentQuery = typedContentQuery; _dynamicContentQuery = dynamicContentQuery; }
/// <summary> /// Constructor /// </summary> /// <param name="tagService"></param> /// <param name="typedContentQuery"></param> public TagQuery(ITagService tagService, ITypedPublishedContentQuery typedContentQuery) { if (tagService == null) { throw new ArgumentNullException("tagService"); } if (typedContentQuery == null) { throw new ArgumentNullException("typedContentQuery"); } _tagService = tagService; _typedContentQuery = typedContentQuery; }
public PageInformationService(ITypedPublishedContentQuery typedPublishedContentQuery, ITemplateHelper templateHelper) { if (typedPublishedContentQuery == null) { throw new ArgumentNullException(nameof(typedPublishedContentQuery)); } if (templateHelper == null) { throw new ArgumentNullException(nameof(templateHelper)); } _typedPublishedContentQuery = typedPublishedContentQuery; _templateHelper = templateHelper; }
/// <summary> /// Returns the Umbraco page id to use as the Not Found page based on the configured 404 pages and the current request /// </summary> /// <param name="error404Collection"></param> /// <param name="requestServerName"> /// The server name attached to the request, normally would be the source of HttpContext.Current.Request.ServerVariables["SERVER_NAME"] /// </param> /// <param name="entityService"></param> /// <param name="publishedContentQuery"></param> /// <param name="domainService"></param> /// <returns></returns> internal static int?GetCurrentNotFoundPageId( IContentErrorPage[] error404Collection, string requestServerName, IEntityService entityService, ITypedPublishedContentQuery publishedContentQuery, IDomainService domainService) { if (error404Collection.Count() > 1) { // try to get the 404 based on current culture (via domain) IContentErrorPage cultureErr; var d = domainService.GetByName(requestServerName); if (d != null && d.LanguageId.HasValue) { // test if a 404 page exists with current culture cultureErr = error404Collection .FirstOrDefault(x => x.Culture == d.LanguageIsoCode); if (cultureErr != null) { return(GetContentIdFromErrorPageConfig(cultureErr, entityService, publishedContentQuery)); } } // test if a 404 page exists with current culture thread cultureErr = error404Collection .FirstOrDefault(x => x.Culture == System.Threading.Thread.CurrentThread.CurrentUICulture.Name); if (cultureErr != null) { return(GetContentIdFromErrorPageConfig(cultureErr, entityService, publishedContentQuery)); } // there should be a default one! cultureErr = error404Collection .FirstOrDefault(x => x.Culture == "default"); if (cultureErr != null) { return(GetContentIdFromErrorPageConfig(cultureErr, entityService, publishedContentQuery)); } } else { return(GetContentIdFromErrorPageConfig(error404Collection.First(), entityService, publishedContentQuery)); } return(null); }
public AnalysisApiController(IAnalyzeService analyzeService, ITypedPublishedContentQuery typedPublishedContentQuery) { if (analyzeService == null) { throw new ArgumentNullException(nameof(analyzeService)); } if (typedPublishedContentQuery == null) { throw new ArgumentNullException(nameof(typedPublishedContentQuery)); } _analyzeService = analyzeService; _typedPublishedContentQuery = typedPublishedContentQuery; }
private void Activator(HttpRequestMessage httpRequestMessage, UmbracoContext umbracoContext, ITypedPublishedContentQuery arg3, ServiceContext serviceContext, BaseSearchProvider searchProvider) { _activator(httpRequestMessage, umbracoContext, arg3, serviceContext, searchProvider); Mapper.Initialize(configuration => { var contentRepresentationMapper = new ContentModelMapper(); contentRepresentationMapper.ConfigureMappings(configuration, umbracoContext.Application); var mediaRepresentationMapper = new MediaModelMapper(); mediaRepresentationMapper.ConfigureMappings(configuration, umbracoContext.Application); var memberRepresentationMapper = new MemberModelMapper(); memberRepresentationMapper.ConfigureMappings(configuration, umbracoContext.Application); var relationRepresentationMapper = new RelationModelMapper(); relationRepresentationMapper.ConfigureMappings(configuration, umbracoContext.Application); }); }
public DashboardDataService(ITypedPublishedContentQuery typedPublishedContentQuery, IPageScoreNodeHelper pageScoreNodeHelper, INodeReportRepository nodeReportRepository) { if (typedPublishedContentQuery == null) { throw new ArgumentNullException(nameof(typedPublishedContentQuery)); } if (pageScoreNodeHelper == null) { throw new ArgumentNullException(nameof(pageScoreNodeHelper)); } if (nodeReportRepository == null) { throw new ArgumentNullException(nameof(nodeReportRepository)); } _typedPublishedContentQuery = typedPublishedContentQuery; _pageScoreNodeHelper = pageScoreNodeHelper; _nodeReportRepository = nodeReportRepository; }
internal static int?GetCurrentNotFoundPageId( IContentErrorPage[] error404Collection, IEntityService entityService, ITypedPublishedContentQuery publishedContentQuery, CultureInfo errorCulture) { if (error404Collection.Length > 1) { // test if a 404 page exists with current culture thread var cultureErr = error404Collection.FirstOrDefault(x => x.Culture == errorCulture.Name) ?? error404Collection.FirstOrDefault(x => x.Culture == "default"); // there should be a default one! if (cultureErr != null) { return(GetContentIdFromErrorPageConfig(cultureErr, entityService, publishedContentQuery)); } } else { return(GetContentIdFromErrorPageConfig(error404Collection.First(), entityService, publishedContentQuery)); } return(null); }
public SitemapController(ITypedPublishedContentQuery typedPublishedContentQuery) { this.typedPublishedContentQuery = typedPublishedContentQuery; }
private void Activator(HttpRequestMessage httpRequestMessage, UmbracoContext umbracoContext, ITypedPublishedContentQuery arg3, ServiceContext serviceContext, BaseSearchProvider searchProvider) { _activator(httpRequestMessage, umbracoContext, arg3, serviceContext, searchProvider); Mapper.Initialize(configuration => { var contentRepresentationMapper = new ContentModelMapper(); contentRepresentationMapper.ConfigureMappings(configuration, umbracoContext.Application); var mediaRepresentationMapper = new MediaModelMapper(); mediaRepresentationMapper.ConfigureMappings(configuration, umbracoContext.Application); var memberRepresentationMapper = new MemberModelMapper(); memberRepresentationMapper.ConfigureMappings(configuration, umbracoContext.Application); var relationRepresentationMapper = new RelationModelMapper(); relationRepresentationMapper.ConfigureMappings(configuration, umbracoContext.Application); }); }
protected abstract ApiController CreateController(Type controllerType, HttpRequestMessage msg, UmbracoHelper helper, ITypedPublishedContentQuery qry, ServiceContext serviceContext, BaseSearchProvider searchProvider);
/// <summary> /// Returns the content id based on the configured IContentErrorPage section /// </summary> /// <param name="errorPage"></param> /// <param name="entityService"></param> /// <param name="publishedContentQuery"></param> /// <returns></returns> internal static int?GetContentIdFromErrorPageConfig(IContentErrorPage errorPage, IEntityService entityService, ITypedPublishedContentQuery publishedContentQuery) { if (errorPage.HasContentId) { return(errorPage.ContentId); } if (errorPage.HasContentKey) { //need to get the Id for the GUID //TODO: When we start storing GUIDs into the IPublishedContent, then we won't have to look this up // but until then we need to look it up in the db. For now we've implemented a cached service for // converting Int -> Guid and vice versa. var found = entityService.GetIdForKey(errorPage.ContentKey, UmbracoObjectTypes.Document); if (found) { return(found.Result); } return(null); } if (errorPage.ContentXPath.IsNullOrWhiteSpace() == false) { try { //we have an xpath statement to execute var xpathResult = UmbracoXPathPathSyntaxParser.ParseXPathQuery( xpathExpression: errorPage.ContentXPath, nodeContextId: null, getPath: nodeid => { var ent = entityService.Get(nodeid); return(ent.Path.Split(',').Reverse()); }, publishedContentExists: i => publishedContentQuery.TypedContent(i) != null); //now we'll try to execute the expression var nodeResult = publishedContentQuery.TypedContentSingleAtXPath(xpathResult); if (nodeResult != null) { return(nodeResult.Id); } } catch (Exception ex) { LogHelper.Error <NotFoundHandlerHelper>("Could not parse xpath expression: " + errorPage.ContentXPath, ex); return(null); } } return(null); }
protected abstract ApiController CreateController(Type controllerType, HttpRequestMessage msg, UmbracoHelper helper, ITypedPublishedContentQuery qry, ServiceContext serviceContext, BaseSearchProvider searchProvider);
protected override ApiController CreateController(Type controllerType, HttpRequestMessage msg, UmbracoHelper helper, ITypedPublishedContentQuery qry, ServiceContext serviceContext, BaseSearchProvider searchProvider) { _onServicesCreated(msg, helper.UmbracoContext, qry, serviceContext, searchProvider); //Create the controller with all dependencies var ctor = controllerType.GetConstructor(new[] { typeof(UmbracoContext), typeof(UmbracoHelper), typeof(BaseSearchProvider) }); if (ctor == null) { throw new MethodAccessException("Could not find the required constructor for the controller"); } var created = (ApiController)ctor.Invoke(new object[] { //ctor args helper.UmbracoContext, helper, searchProvider }); return(created); }
public static UmbracoHelper GetUmbracoHelper(UmbracoContext context, ICultureDictionary cultureDictionary = null, MembershipHelper membershipHelper = null, UrlProvider urlProvider = null, IPublishedContent content = null, ITypedPublishedContentQuery typedQuery = null, IDynamicPublishedContentQuery dynamicQuery = null, ITagQuery tagQuery = null, IDataTypeService typeService = null, IUmbracoComponentRenderer componentRenderer = null) { return(new UmbracoHelper(context, content ?? Mock.Of <IPublishedContent>(), typedQuery ?? Mock.Of <ITypedPublishedContentQuery>(), dynamicQuery ?? Mock.Of <IDynamicPublishedContentQuery>(), tagQuery ?? Mock.Of <ITagQuery>(), typeService ?? Mock.Of <IDataTypeService>(), urlProvider ?? GetUmbracoUrlProvider(context), cultureDictionary ?? Mock.Of <ICultureDictionary>(), componentRenderer ?? Mock.Of <IUmbracoComponentRenderer>(), membershipHelper ?? GetUmbracoMembershipHelper(context))); }
public RenderContentController(ExamineManager examineManager, ITypedPublishedContentQuery contentQuery) { _examineManager = examineManager; _contentQuery = contentQuery; }
public PublishedContentManager(ITypedPublishedContentQuery umbraContentQuery) { _umbracoContentQuery = umbraContentQuery; }