/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { string retVal = string.Empty; Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); if (this.PublicationId != 0) { PublicationCriteria correctSite = new PublicationCriteria(this.PublicationId); allCriteria.AddCriteria(correctSite); } pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(resultUris[0]); } return(retVal); }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { LoggerService.Debug(">>GetContentByUrl({0})", LoggingCategory.Performance, Url); string retVal = string.Empty; LoggerService.Debug("GetContentByUrl: about to create query", LoggingCategory.Performance); Query pageQuery = new Query(); LoggerService.Debug("GetContentByUrl: created query", LoggingCategory.Performance); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); if (this.PublicationId != 0) { PublicationCriteria correctSite = new PublicationCriteria(this.PublicationId); allCriteria.AddCriteria(correctSite); } pageQuery.Criteria = allCriteria; LoggerService.Debug("GetContentByUrl: added criteria to query", LoggingCategory.Performance); LoggerService.Debug("GetContentByUrl: about to execute query", LoggingCategory.Performance); string[] resultUris = pageQuery.ExecuteQuery(); LoggerService.Debug("GetContentByUrl: executed query", LoggingCategory.Performance); if (resultUris.Length > 0) { retVal = PageContentAssembler.GetContent(resultUris[0]); LoggerService.Debug("GetContentByUrl: executed PageContentAssembler", LoggingCategory.Performance); } LoggerService.Debug("<<GetContentByUrl({0})", LoggingCategory.Performance, Url); return(retVal); }
string IRawDataProvider.GetPageContent(string urlPath, Localization localization) { // TODO: let the DXA Model Service provide raw Page Content too (?) using (new Tracer(urlPath, localization)) { if (!urlPath.EndsWith(Constants.DefaultExtension) && !urlPath.EndsWith(".json")) { urlPath += Constants.DefaultExtension; } string escapedUrlPath = Uri.EscapeUriString(urlPath); global::Tridion.ContentDelivery.DynamicContent.Query.Query brokerQuery = new global::Tridion.ContentDelivery.DynamicContent.Query.Query { Criteria = CriteriaFactory.And(new Criteria[] { new PageURLCriteria(escapedUrlPath), new PublicationCriteria(Convert.ToInt32(localization.Id)), new ItemTypeCriteria(64) }) }; string[] pageUris = brokerQuery.ExecuteQuery(); if (pageUris.Length == 0) { return(null); } if (pageUris.Length > 1) { throw new DxaException($"Broker Query for Page URL path '{urlPath}' in Publication '{localization.Id}' returned {pageUris.Length} results."); } PageContentAssembler pageContentAssembler = new PageContentAssembler(); return(pageContentAssembler.GetContent(pageUris[0])); } }
/// <summary> /// Gets the raw string (xml) from the broker db by URI /// </summary> /// <param name="Url">TCM URI of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUri(string TcmUri) { string retVal = string.Empty; retVal = PageContentAssembler.GetContent(TcmUri); return(retVal); }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> private string GetStringContentFromBrokerByUrl(string Url) { string retVal = string.Empty; Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); PublicationCriteria correctSite = new PublicationCriteria(PublicationId); //Todo: add logic to determine site on url Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); allCriteria.AddCriteria(correctSite); pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(resultUris[0]); } return(retVal); }
/// <summary> /// Gets the raw string (xml) from the broker db by URI /// </summary> /// <param name="Url">TCM URI of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUri(string TcmUri) { string retVal = string.Empty; PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(TcmUri); return(retVal); }
/// <summary> /// Gets the raw string (xml) from the broker db by URI /// </summary> /// <param name="Url">TCM URI of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> private string GetStringContentFromBrokerByUri(string TcmUri) { string retVal = string.Empty; PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(TcmUri); return(retVal); }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { LoggerService.Debug(">>GetContentByUrl({0})", LoggingCategory.Performance, Url); string retVal = string.Empty; LoggerService.Debug("GetContentByUrl: about to create query", LoggingCategory.Performance); using (var pageQuery = new Query()) { LoggerService.Debug("GetContentByUrl: created query", LoggingCategory.Performance); using (var isPage = new ItemTypeCriteria(64)) { using (var pageUrl = new PageURLCriteria(Url)) { using (var allCriteria = CriteriaFactory.And(isPage, pageUrl)) { if (this.PublicationId != 0) { using (var correctSite = new PublicationCriteria(this.PublicationId)) { allCriteria.AddCriteria(correctSite); } } pageQuery.Criteria = allCriteria; } } } LoggerService.Debug("GetContentByUrl: added criteria to query", LoggingCategory.Performance); LoggerService.Debug("GetContentByUrl: about to execute query", LoggingCategory.Performance); string[] resultUris = pageQuery.ExecuteQuery(); pageQuery.Dispose(); LoggerService.Debug("GetContentByUrl: executed query", LoggingCategory.Performance); if (resultUris.Length > 0) { retVal = PageContentAssembler.GetContent(resultUris[0]); LoggerService.Debug("GetContentByUrl: executed PageContentAssembler", LoggingCategory.Performance); } LoggerService.Debug("<<GetContentByUrl({0})", LoggingCategory.Performance, Url); return(retVal); } }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { string retVal = string.Empty; Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); if (this.PublicationId != 0) { PublicationCriteria correctSite = new PublicationCriteria(this.PublicationId); allCriteria.AddCriteria(correctSite); } pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(resultUris[0]); } return retVal; }
/// <summary> /// Gets the raw string (xml) from the broker db by URI /// </summary> /// <param name="Url">TCM URI of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUri(string TcmUri) { string retVal = string.Empty; PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(TcmUri); return retVal; }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> private string GetStringContentFromBrokerByUrl(string Url) { string retVal = string.Empty; Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); PublicationCriteria correctSite = new PublicationCriteria(PublicationId); //Todo: add logic to determine site on url Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); allCriteria.AddCriteria(correctSite); pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(resultUris[0]); } return retVal; }
/// <summary> /// Gets the raw string (xml) from the broker db by URI /// </summary> /// <param name="Url">TCM URI of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> private string GetStringContentFromBrokerByUri(string TcmUri) { string retVal = string.Empty; PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(TcmUri); return retVal; }