use of org.broadleafcommerce.common.sitemap.domain.SiteMapUrlEntry 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.domain.SiteMapUrlEntry in project BroadleafCommerce by BroadleafCommerce.
the class CustomUrlSiteMapGeneratorTest method getConfiguration.
public CustomUrlSiteMapGeneratorConfiguration getConfiguration() {
SiteMapUrlEntry urlEntry1 = new SiteMapUrlEntryImpl();
urlEntry1.setLastMod(new Date());
urlEntry1.setLocation("http://www.heatclinic.com/1");
urlEntry1.setSiteMapChangeFreq(SiteMapChangeFreqType.HOURLY);
urlEntry1.setSiteMapPriority(SiteMapPriorityType.POINT5);
SiteMapUrlEntry urlEntry2 = new SiteMapUrlEntryImpl();
urlEntry2.setLastMod(new Date());
urlEntry2.setLocation("2");
urlEntry2.setSiteMapChangeFreq(SiteMapChangeFreqType.HOURLY);
urlEntry2.setSiteMapPriority(SiteMapPriorityType.POINT5);
SiteMapUrlEntry urlEntry3 = new SiteMapUrlEntryImpl();
urlEntry3.setLastMod(new Date());
urlEntry3.setLocation("/3");
urlEntry3.setSiteMapChangeFreq(SiteMapChangeFreqType.HOURLY);
urlEntry3.setSiteMapPriority(SiteMapPriorityType.POINT5);
List<SiteMapUrlEntry> urlEntries = new ArrayList<>();
urlEntries.add(urlEntry1);
urlEntries.add(urlEntry2);
urlEntries.add(urlEntry3);
CustomUrlSiteMapGeneratorConfiguration smgc = new CustomUrlSiteMapGeneratorConfigurationImpl();
smgc.setDisabled(false);
smgc.setSiteMapGeneratorType(SiteMapGeneratorType.CUSTOM);
smgc.setCustomURLEntries(urlEntries);
return smgc;
}
Aggregations