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.taglib.ui;
016    
017    import com.liferay.portal.kernel.portlet.PortletRequestModel;
018    import com.liferay.taglib.util.IncludeTag;
019    
020    import javax.servlet.http.HttpServletRequest;
021    
022    /**
023     * @author Raymond Aug??
024     */
025    public class JournalArticleTag extends IncludeTag {
026    
027            public void setArticleId(String articleId) {
028                    _articleId = articleId;
029            }
030    
031            public void setArticlePage(int articlePage) {
032                    _articlePage = articlePage;
033            }
034    
035            public void setArticleResourcePrimKey(long articleResourcePrimKey) {
036                    _articleResourcePrimKey = articleResourcePrimKey;
037            }
038    
039            public void setGroupId(long groupId) {
040                    _groupId = groupId;
041            }
042    
043            public void setLanguageId(String languageId) {
044                    _languageId = languageId;
045            }
046    
047            public void setPortletRequestModel(
048                    PortletRequestModel portletRequestModel) {
049    
050                    _portletRequestModel = portletRequestModel;
051            }
052    
053            public void setShowAvailableLocales(boolean showAvailableLocales) {
054                    _showAvailableLocales = showAvailableLocales;
055            }
056    
057            public void setShowTitle(boolean showTitle) {
058                    _showTitle = showTitle;
059            }
060    
061            public void setTemplateId(String templateId) {
062                    _templateId = templateId;
063            }
064    
065            @Override
066            protected void cleanUp() {
067                    _articleId = null;
068                    _articlePage = 1;
069                    _articleResourcePrimKey = 0;
070                    _groupId = 0;
071                    _languageId = null;
072                    _portletRequestModel = null;
073                    _showAvailableLocales = false;
074                    _showTitle = false;
075                    _templateId = null;
076            }
077    
078            @Override
079            protected String getPage() {
080                    return _PAGE;
081            }
082    
083            @Override
084            protected void setAttributes(HttpServletRequest request) {
085                    request.setAttribute(
086                            "liferay-ui:journal-article:articleId", _articleId);
087                    request.setAttribute(
088                            "liferay-ui:journal-article:articlePage",
089                            String.valueOf(_articlePage));
090                    request.setAttribute(
091                            "liferay-ui:journal-article:articleResourcePrimKey",
092                            String.valueOf(_articleResourcePrimKey));
093                    request.setAttribute(
094                            "liferay-ui:journal-article:groupId", String.valueOf(_groupId));
095                    request.setAttribute(
096                            "liferay-ui:journal-article:languageId", _languageId);
097                    request.setAttribute(
098                            "liferay-ui:journal-article:portletRequestModel",
099                            _portletRequestModel);
100                    request.setAttribute(
101                            "liferay-ui:journal-article:showAvailableLocales",
102                            String.valueOf(_showAvailableLocales));
103                    request.setAttribute(
104                            "liferay-ui:journal-article:showTitle", String.valueOf(_showTitle));
105                    request.setAttribute(
106                            "liferay-ui:journal-article:templateId", _templateId);
107            }
108    
109            private static final String _PAGE =
110                    "/html/taglib/ui/journal_article/page.jsp";
111    
112            private String _articleId;
113            private int _articlePage = 1;
114            private long _articleResourcePrimKey;
115            private long _groupId;
116            private String _languageId;
117            private PortletRequestModel _portletRequestModel;
118            private boolean _showAvailableLocales;
119            private boolean _showTitle;
120            private String _templateId;
121    
122    }