001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.layoutsadmin.util;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
019    import com.liferay.portal.kernel.util.UnicodeProperties;
020    import com.liferay.portal.kernel.xml.Element;
021    import com.liferay.portal.model.Layout;
022    import com.liferay.portal.theme.ThemeDisplay;
023    
024    import java.util.Date;
025    import java.util.Locale;
026    import java.util.Map;
027    
028    /**
029     * @author Raymond Aug??
030     */
031    public class SitemapUtil {
032    
033            public static void addURLElement(
034                    Element element, String url, UnicodeProperties typeSettingsProperties,
035                    Date modifiedDate, String canonicalURL,
036                    Map<Locale, String> alternateURLs) {
037    
038                    getSitemap().addURLElement(
039                            element, url, typeSettingsProperties, modifiedDate, canonicalURL,
040                            alternateURLs);
041            }
042    
043            public static String encodeXML(String input) {
044                    return getSitemap().encodeXML(input);
045            }
046    
047            public static Map<Locale, String> getAlternateURLs(
048                            String canonicalURL, ThemeDisplay themeDisplay, Layout layout)
049                    throws PortalException {
050    
051                    return getSitemap().getAlternateURLs(
052                            canonicalURL, themeDisplay, layout);
053            }
054    
055            public static Sitemap getSitemap() {
056                    PortalRuntimePermission.checkGetBeanProperty(SitemapUtil.class);
057    
058                    return _sitemap;
059            }
060    
061            public static String getSitemap(
062                            long groupId, boolean privateLayout, ThemeDisplay themeDisplay)
063                    throws PortalException {
064    
065                    return getSitemap().getSitemap(groupId, privateLayout, themeDisplay);
066            }
067    
068            public void setSitemap(Sitemap sitemap) {
069                    PortalRuntimePermission.checkSetBeanProperty(getClass());
070    
071                    _sitemap = sitemap;
072            }
073    
074            private static Sitemap _sitemap;
075    
076    }