protected Date generateDate(SiteMapUrlEntry urlEntry) { if (urlEntry.getLastMod() != null) { return urlEntry.getLastMod(); } else { return new Date(); } }
protected String generateUri(SiteMapBuilder smb, SiteMapUrlEntry urlEntry) { String url = urlEntry.getLocation(); if (url.contains("://")) { return url; } else { return BroadleafFileUtils.buildFilePath(smb.getBaseUrl(), url); } }
@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); } }