Search in sources :

Example 1 with SiteMapURLWrapper

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);
    }
}
Also used : CustomUrlSiteMapGeneratorConfiguration(org.broadleafcommerce.common.sitemap.domain.CustomUrlSiteMapGeneratorConfiguration) SiteMapUrlEntry(org.broadleafcommerce.common.sitemap.domain.SiteMapUrlEntry) SiteMapURLWrapper(org.broadleafcommerce.common.sitemap.wrapper.SiteMapURLWrapper)

Example 2 with SiteMapURLWrapper

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);
}
Also used : Product(org.broadleafcommerce.core.catalog.domain.Product) SiteMapURLWrapper(org.broadleafcommerce.common.sitemap.wrapper.SiteMapURLWrapper)

Example 3 with SiteMapURLWrapper

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);
    }
}
Also used : SiteMapURLWrapper(org.broadleafcommerce.common.sitemap.wrapper.SiteMapURLWrapper)

Example 4 with SiteMapURLWrapper

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);
}
Also used : ProductBundle(org.broadleafcommerce.core.catalog.domain.ProductBundle) Product(org.broadleafcommerce.core.catalog.domain.Product) Sku(org.broadleafcommerce.core.catalog.domain.Sku) SiteMapURLWrapper(org.broadleafcommerce.common.sitemap.wrapper.SiteMapURLWrapper)

Example 5 with SiteMapURLWrapper

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);
}
Also used : Page(org.broadleafcommerce.cms.page.domain.Page) SiteMapURLWrapper(org.broadleafcommerce.common.sitemap.wrapper.SiteMapURLWrapper)

Aggregations

SiteMapURLWrapper (org.broadleafcommerce.common.sitemap.wrapper.SiteMapURLWrapper)5 Product (org.broadleafcommerce.core.catalog.domain.Product)2 Page (org.broadleafcommerce.cms.page.domain.Page)1 CustomUrlSiteMapGeneratorConfiguration (org.broadleafcommerce.common.sitemap.domain.CustomUrlSiteMapGeneratorConfiguration)1 SiteMapUrlEntry (org.broadleafcommerce.common.sitemap.domain.SiteMapUrlEntry)1 ProductBundle (org.broadleafcommerce.core.catalog.domain.ProductBundle)1 Sku (org.broadleafcommerce.core.catalog.domain.Sku)1