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;
016    
017    import com.liferay.portal.kernel.portlet.LiferayPortletURL;
018    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
019    import com.liferay.portal.model.Layout;
020    
021    import javax.portlet.PortletRequest;
022    
023    import javax.servlet.http.HttpServletRequest;
024    
025    /**
026     * @author Brian Wing Shun Chan
027     */
028    public class PortletURLFactoryUtil {
029    
030            public static LiferayPortletURL create(
031                    HttpServletRequest request, String portletId, Layout layout,
032                    String lifecycle) {
033    
034                    return getPortletURLFactory().create(
035                            request, portletId, layout, lifecycle);
036            }
037    
038            public static LiferayPortletURL create(
039                    HttpServletRequest request, String portletId, long plid,
040                    String lifecycle) {
041    
042                    return getPortletURLFactory().create(
043                            request, portletId, plid, lifecycle);
044            }
045    
046            public static LiferayPortletURL create(
047                    PortletRequest portletRequest, String portletId, Layout layout,
048                    String lifecycle) {
049    
050                    return getPortletURLFactory().create(
051                            portletRequest, portletId, layout, lifecycle);
052            }
053    
054            public static LiferayPortletURL create(
055                    PortletRequest portletRequest, String portletId, long plid,
056                    String lifecycle) {
057    
058                    return getPortletURLFactory().create(
059                            portletRequest, portletId, plid, lifecycle);
060            }
061    
062            public static PortletURLFactory getPortletURLFactory() {
063                    PortalRuntimePermission.checkGetBeanProperty(
064                            PortletURLFactoryUtil.class);
065    
066                    return _portletURLFactory;
067            }
068    
069            public void setPortletURLFactory(PortletURLFactory portletURLFactory) {
070                    PortalRuntimePermission.checkSetBeanProperty(getClass());
071    
072                    _portletURLFactory = portletURLFactory;
073            }
074    
075            private static PortletURLFactory _portletURLFactory;
076    
077    }