/// <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); }
/// <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> 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> /// Get all urls of published pages /// </summary> /// <param name="includeExtensions"></param> /// <param name="pathStarts"></param> /// <param name="publicationID"></param> /// <returns></returns> public string[] GetAllPublishedPageUrls(string[] includeExtensions, string[] pathStarts) { Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PublicationCriteria currentPublication = new PublicationCriteria(PublicationId); //Todo: add logic to determine site on url Criteria pageInPublication = CriteriaFactory.And(isPage, currentPublication); if (includeExtensions.Length > 0) { PageURLCriteria[] extensionsCriteria = new PageURLCriteria[includeExtensions.Length]; int criteriaCount = 0; foreach (string pageExtension in includeExtensions) { extensionsCriteria.SetValue(new PageURLCriteria("%" + pageExtension, Criteria.Like), criteriaCount); criteriaCount++; } Criteria allExtensions = CriteriaFactory.Or(extensionsCriteria); pageInPublication = CriteriaFactory.And(pageInPublication, allExtensions); } if (pathStarts.Length > 0) { PageURLCriteria[] pathCriteria = new PageURLCriteria[pathStarts.Length]; int criteriaCount = 0; foreach (string requiredPath in pathStarts) { pathCriteria.SetValue(new PageURLCriteria(requiredPath + "%", Criteria.Like), criteriaCount); criteriaCount++; } Criteria allPaths = CriteriaFactory.Or(pathCriteria); pageInPublication = CriteriaFactory.And(pageInPublication, allPaths); } Query findPages = new Query(pageInPublication); string[] pageUris = findPages.ExecuteQuery(); // Need to get PageMeta data to find all the urls List <string> pageUrls = new List <string>(); foreach (string uri in pageUris) { TcmUri tcmUri = new TcmUri(uri); PageMetaFactory metaFactory = GetPageMetaFactory(tcmUri.PublicationId); IPageMeta currentMeta = metaFactory.GetMeta(uri); pageUrls.Add(currentMeta.UrlPath); } return(pageUrls.ToArray()); }
/// <summary> /// Get all urls of published pages /// </summary> /// <param name="includeExtensions"></param> /// <param name="pathStarts"></param> /// <param name="publicationID"></param> /// <returns></returns> public string[] GetAllPublishedPageUrls(string[] includeExtensions, string[] pathStarts) { Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PublicationCriteria currentPublication = new PublicationCriteria(PublicationId); //Todo: add logic to determine site on url Criteria pageInPublication = CriteriaFactory.And(isPage, currentPublication); if (includeExtensions.Length > 0) { PageURLCriteria[] extensionsCriteria = new PageURLCriteria[includeExtensions.Length]; int criteriaCount = 0; foreach (string pageExtension in includeExtensions) { extensionsCriteria.SetValue(new PageURLCriteria("%" + pageExtension, Criteria.Like), criteriaCount); criteriaCount++; } Criteria allExtensions = CriteriaFactory.Or(extensionsCriteria); pageInPublication = CriteriaFactory.And(pageInPublication, allExtensions); } if (pathStarts.Length > 0) { PageURLCriteria[] pathCriteria = new PageURLCriteria[pathStarts.Length]; int criteriaCount = 0; foreach (string requiredPath in pathStarts) { pathCriteria.SetValue(new PageURLCriteria(requiredPath + "%", Criteria.Like), criteriaCount); criteriaCount++; } Criteria allPaths = CriteriaFactory.Or(pathCriteria); pageInPublication = CriteriaFactory.And(pageInPublication, allPaths); } Query findPages = new Query(pageInPublication); string[] pageUris = findPages.ExecuteQuery(); // Need to get PageMeta data to find all the urls List<string> pageUrls = new List<string>(); foreach (string uri in pageUris) { TcmUri tcmUri = new TcmUri(uri); PageMetaFactory metaFactory = GetPageMetaFactory(tcmUri.PublicationId); IPageMeta currentMeta = metaFactory.GetMeta(uri); pageUrls.Add(currentMeta.UrlPath); } return pageUrls.ToArray(); }
/// <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) { 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) { 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; }
/// <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> 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; }