Example usage for com.liferay.portal.util PropsValues SITES_SITEMAP_DEFAULT_PRIORITY

List of usage examples for com.liferay.portal.util PropsValues SITES_SITEMAP_DEFAULT_PRIORITY

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues SITES_SITEMAP_DEFAULT_PRIORITY.

Prototype

String SITES_SITEMAP_DEFAULT_PRIORITY

To view the source code for com.liferay.portal.util PropsValues SITES_SITEMAP_DEFAULT_PRIORITY.

Click Source Link

Usage

From source file:com.liferay.portlet.layoutsadmin.util.SitemapImpl.java

License:Open Source License

protected void addURLElement(Element element, String url, UnicodeProperties typeSettingsProperties,
        Date modifiedDate) {/*from   w  w w.ja  v  a2  s. c o  m*/

    Element urlElement = element.addElement("url");

    Element locElement = urlElement.addElement("loc");

    locElement.addText(encodeXML(url));

    if (typeSettingsProperties == null) {
        if (Validator.isNotNull(PropsValues.SITES_SITEMAP_DEFAULT_CHANGE_FREQUENCY)) {

            Element changefreqElement = urlElement.addElement("changefreq");

            changefreqElement.addText(PropsValues.SITES_SITEMAP_DEFAULT_CHANGE_FREQUENCY);
        }

        if (Validator.isNotNull(PropsValues.SITES_SITEMAP_DEFAULT_PRIORITY)) {

            Element priorityElement = urlElement.addElement("priority");

            priorityElement.addText(PropsValues.SITES_SITEMAP_DEFAULT_PRIORITY);
        }
    } else {
        String changefreq = typeSettingsProperties.getProperty("sitemap-changefreq");

        if (Validator.isNotNull(changefreq)) {
            Element changefreqElement = urlElement.addElement("changefreq");

            changefreqElement.addText(changefreq);
        } else if (Validator.isNotNull(PropsValues.SITES_SITEMAP_DEFAULT_CHANGE_FREQUENCY)) {

            Element changefreqElement = urlElement.addElement("changefreq");

            changefreqElement.addText(PropsValues.SITES_SITEMAP_DEFAULT_CHANGE_FREQUENCY);
        }

        String priority = typeSettingsProperties.getProperty("sitemap-priority");

        if (Validator.isNotNull(priority)) {
            Element priorityElement = urlElement.addElement("priority");

            priorityElement.addText(priority);
        } else if (Validator.isNotNull(PropsValues.SITES_SITEMAP_DEFAULT_PRIORITY)) {

            Element priorityElement = urlElement.addElement("priority");

            priorityElement.addText(PropsValues.SITES_SITEMAP_DEFAULT_PRIORITY);
        }
    }

    if (modifiedDate != null) {
        Element modifiedDateElement = urlElement.addElement("lastmod");

        DateFormat iso8601DateFormat = DateUtil.getISO8601Format();

        modifiedDateElement.addText(iso8601DateFormat.format(modifiedDate));
    }
}