use of org.broadleafcommerce.common.sitemap.wrapper.SiteMapURLWrapper in project BroadleafCommerce by BroadleafCommerce.
the class CustomUrlSiteMapGenerator method addSiteMapEntries.
@Override
public void addSiteMapEntries(SiteMapGeneratorConfiguration smgc, SiteMapBuilder siteMapBuilder) {
for (SiteMapUrlEntry urlEntry : ((CustomUrlSiteMapGeneratorConfiguration) smgc).getCustomURLEntries()) {
if (StringUtils.isEmpty(urlEntry.getLocation())) {
continue;
}
SiteMapURLWrapper siteMapUrl = new SiteMapURLWrapper();
// location
siteMapUrl.setLoc(generateUri(siteMapBuilder, urlEntry));
// change frequency
if (urlEntry.getSiteMapChangeFreq() != null) {
siteMapUrl.setChangeFreqType(urlEntry.getSiteMapChangeFreq());
} else {
siteMapUrl.setChangeFreqType(smgc.getSiteMapChangeFreq());
}
// priority
if (urlEntry.getSiteMapPriority() != null) {
siteMapUrl.setPriorityType(urlEntry.getSiteMapPriority());
} else {
siteMapUrl.setPriorityType(smgc.getSiteMapPriority());
}
// lastModDate
siteMapUrl.setLastModDate(generateDate(urlEntry));
siteMapBuilder.addUrl(siteMapUrl);
}
}
use of org.broadleafcommerce.common.sitemap.wrapper.SiteMapURLWrapper in project BroadleafCommerce by BroadleafCommerce.
the class ProductSiteMapGenerator method addSiteMapEntries.
@Override
public void addSiteMapEntries(SiteMapGeneratorConfiguration smgc, SiteMapBuilder siteMapBuilder) {
int pageNum = 0;
List<Product> products;
do {
products = productDao.readAllActiveProducts(pageNum++, pageSize);
for (Product product : products) {
if (StringUtils.isEmpty(product.getUrl())) {
continue;
}
SiteMapURLWrapper siteMapUrl = new SiteMapURLWrapper();
// location
siteMapUrl.setLoc(generateUri(siteMapBuilder, product));
// change frequency
siteMapUrl.setChangeFreqType(smgc.getSiteMapChangeFreq());
// priority
siteMapUrl.setPriorityType(smgc.getSiteMapPriority());
// lastModDate
siteMapUrl.setLastModDate(generateDate(product));
constructImageURLs(siteMapBuilder, siteMapUrl, product);
siteMapBuilder.addUrl(siteMapUrl);
}
} while (products.size() == pageSize);
}
use of org.broadleafcommerce.common.sitemap.wrapper.SiteMapURLWrapper in project BroadleafCommerce by BroadleafCommerce.
the class CategorySiteMapGenerator method constructSiteMapURLs.
protected void constructSiteMapURLs(CategorySiteMapGeneratorConfiguration categorySMGC, SiteMapBuilder siteMapBuilder, Category category) {
Integer categoryPageCount = getPageCountForCategory(category);
for (int pageNumber = 1; pageNumber <= categoryPageCount; pageNumber++) {
SiteMapURLWrapper siteMapUrl = new SiteMapURLWrapper();
// location
siteMapUrl.setLoc(generateUrl(siteMapBuilder, category, pageNumber));
// change frequency
siteMapUrl.setChangeFreqType(categorySMGC.getSiteMapChangeFreq());
// priority
siteMapUrl.setPriorityType(categorySMGC.getSiteMapPriority());
// lastModDate
siteMapUrl.setLastModDate(generateDate(category));
constructImageURLs(siteMapBuilder, siteMapUrl, category);
siteMapBuilder.addUrl(siteMapUrl);
}
}
use of org.broadleafcommerce.common.sitemap.wrapper.SiteMapURLWrapper in project BroadleafCommerce by BroadleafCommerce.
the class SkuSiteMapGenerator method addSiteMapEntries.
@Override
public void addSiteMapEntries(SiteMapGeneratorConfiguration smgc, SiteMapBuilder siteMapBuilder) {
int pageNum = 0;
List<Sku> skus;
do {
skus = skuDao.readAllActiveSkus(pageNum++, pageSize);
for (Sku sku : skus) {
Product defaultProduct = sku.getDefaultProduct();
if (defaultProduct != null && CollectionUtils.isNotEmpty(defaultProduct.getAdditionalSkus())) {
continue;
}
if (defaultProduct instanceof ProductBundle) {
continue;
}
if (StringUtils.isEmpty(sku.getProduct().getUrl() + sku.getUrlKey())) {
continue;
}
SiteMapURLWrapper siteMapUrl = new SiteMapURLWrapper();
// location
siteMapUrl.setLoc(generateUri(siteMapBuilder, sku));
// change frequency
siteMapUrl.setChangeFreqType(smgc.getSiteMapChangeFreq());
// priority
siteMapUrl.setPriorityType(smgc.getSiteMapPriority());
// lastModDate
siteMapUrl.setLastModDate(generateDate(sku));
constructImageURLs(siteMapBuilder, siteMapUrl, sku);
siteMapBuilder.addUrl(siteMapUrl);
}
} while (skus.size() == pageSize);
}
use of org.broadleafcommerce.common.sitemap.wrapper.SiteMapURLWrapper in project BroadleafCommerce by BroadleafCommerce.
the class PageSiteMapGenerator method addSiteMapEntries.
@Override
public void addSiteMapEntries(SiteMapGeneratorConfiguration smgc, SiteMapBuilder siteMapBuilder) {
int rowOffset = 0;
List<Page> pages;
String previousUrl = "";
do {
pages = pageDao.readOnlineAndIncludedPages(rowLimit, rowOffset, "fullUrl");
rowOffset += pages.size();
for (Page page : pages) {
if (page.getExcludeFromSiteMap()) {
continue;
}
String currentURL = page.getFullUrl();
if (previousUrl.equals(currentURL)) {
continue;
} else {
previousUrl = currentURL;
}
SiteMapURLWrapper siteMapUrl = new SiteMapURLWrapper();
// location
siteMapUrl.setLoc(generateUri(siteMapBuilder, page));
// change frequency
siteMapUrl.setChangeFreqType(smgc.getSiteMapChangeFreq());
// priority
siteMapUrl.setPriorityType(smgc.getSiteMapPriority());
// lastModDate
siteMapUrl.setLastModDate(generateDate(page));
siteMapBuilder.addUrl(siteMapUrl);
}
} while (pages.size() == rowLimit);
}
Aggregations