Example usage for com.liferay.portal.kernel.util DateUtil getISO8601Format

List of usage examples for com.liferay.portal.kernel.util DateUtil getISO8601Format

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util DateUtil getISO8601Format.

Prototype

public static DateFormat getISO8601Format() 

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) {/*  w ww  .j  a v a2 s .c  om*/

    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));
    }
}