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