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.model.Layout;
018    import com.liferay.portal.kernel.portlet.LiferayPortletURL;
019    import com.liferay.portal.kernel.portlet.PortletURLFactory;
020    import com.liferay.portal.kernel.security.pacl.DoPrivileged;
021    
022    import javax.portlet.PortletRequest;
023    
024    import javax.servlet.http.HttpServletRequest;
025    
026    /**
027     * @author Brian Wing Shun Chan
028     */
029    @DoPrivileged
030    public class PortletURLFactoryImpl implements PortletURLFactory {
031    
032            @Override
033            public LiferayPortletURL create(
034                    HttpServletRequest request, String portletId, Layout layout,
035                    String lifecycle) {
036    
037                    return new PortletURLImpl(request, portletId, layout, lifecycle);
038            }
039    
040            @Override
041            public LiferayPortletURL create(
042                    HttpServletRequest request, String portletId, long plid,
043                    String lifecycle) {
044    
045                    return new PortletURLImpl(request, portletId, plid, lifecycle);
046            }
047    
048            @Override
049            public LiferayPortletURL create(
050                    PortletRequest portletRequest, String portletId, Layout layout,
051                    String lifecycle) {
052    
053                    return new PortletURLImpl(portletRequest, portletId, layout, lifecycle);
054            }
055    
056            @Override
057            public LiferayPortletURL create(
058                    PortletRequest portletRequest, String portletId, long plid,
059                    String lifecycle) {
060    
061                    return new PortletURLImpl(portletRequest, portletId, plid, lifecycle);
062            }
063    
064    }