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 setDDMTemplateKey(String ddmTemplateKey) {
040                    _ddmTemplateKey = ddmTemplateKey;
041            }
042    
043            public void setGroupId(long groupId) {
044                    _groupId = groupId;
045            }
046    
047            public void setLanguageId(String languageId) {
048                    _languageId = languageId;
049            }
050    
051            public void setPortletRequestModel(
052                    PortletRequestModel portletRequestModel) {
053    
054                    _portletRequestModel = portletRequestModel;
055            }
056    
057            public void setShowAvailableLocales(boolean showAvailableLocales) {
058                    _showAvailableLocales = showAvailableLocales;
059            }
060    
061            public void setShowTitle(boolean showTitle) {
062                    _showTitle = showTitle;
063            }
064    
065            @Override
066            protected void cleanUp() {
067                    _articleId = null;
068                    _articlePage = 1;
069                    _articleResourcePrimKey = 0;
070                    _ddmTemplateKey = null;
071                    _groupId = 0;
072                    _languageId = null;
073                    _portletRequestModel = null;
074                    _showAvailableLocales = false;
075                    _showTitle = false;
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:ddmTemplateKey", _ddmTemplateKey);
095                    request.setAttribute(
096                            "liferay-ui:journal-article:groupId", String.valueOf(_groupId));
097                    request.setAttribute(
098                            "liferay-ui:journal-article:languageId", _languageId);
099                    request.setAttribute(
100                            "liferay-ui:journal-article:portletRequestModel",
101                            _portletRequestModel);
102                    request.setAttribute(
103                            "liferay-ui:journal-article:showAvailableLocales",
104                            String.valueOf(_showAvailableLocales));
105                    request.setAttribute(
106                            "liferay-ui:journal-article:showTitle", String.valueOf(_showTitle));
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 String _ddmTemplateKey;
116            private long _groupId;
117            private String _languageId;
118            private PortletRequestModel _portletRequestModel;
119            private boolean _showAvailableLocales;
120            private boolean _showTitle;
121    
122    }