1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.taglib.ui;
24  
25  import com.liferay.taglib.util.IncludeTag;
26  
27  import javax.servlet.http.HttpServletRequest;
28  
29  /**
30   * <a href="JournalArticleTag.java.html"><b><i>View Source</i></b></a>
31   *
32   * @author Raymond Augé
33   */
34  public class JournalArticleTag extends IncludeTag {
35  
36      public int doStartTag() {
37          HttpServletRequest request =
38              (HttpServletRequest)pageContext.getRequest();
39  
40          request.setAttribute(
41              "liferay-ui:journal-article:articleResourcePrimKey",
42              String.valueOf(_articleResourcePrimKey));
43          request.setAttribute(
44              "liferay-ui:journal-article:groupId", String.valueOf(_groupId));
45          request.setAttribute(
46              "liferay-ui:journal-article:articleId", _articleId);
47          request.setAttribute(
48              "liferay-ui:journal-template:templateId", _templateId);
49          request.setAttribute(
50              "liferay-ui:journal-article:languageId", _languageId);
51          request.setAttribute(
52              "liferay-ui:journal-article:articlePage",
53              String.valueOf(_articlePage));
54          request.setAttribute(
55              "liferay-ui:journal-article:xmlRequest", _xmlRequest);
56          request.setAttribute(
57              "liferay-ui:journal-article:showTitle", String.valueOf(_showTitle));
58          request.setAttribute(
59              "liferay-ui:journal-article:showAvailableLocales",
60              String.valueOf(_showAvailableLocales));
61  
62          return EVAL_BODY_BUFFERED;
63      }
64  
65      public void setArticleResourcePrimKey(long articleResourcePrimKey) {
66          _articleResourcePrimKey = articleResourcePrimKey;
67      }
68  
69      public void setGroupId(long groupId) {
70          _groupId = groupId;
71      }
72  
73      public void setArticleId(String articleId) {
74          _articleId = articleId;
75      }
76  
77      public void setTemplateId(String templateId) {
78          _templateId = templateId;
79      }
80  
81      public void setLanguageId(String languageId) {
82          _languageId = languageId;
83      }
84  
85      public void setArticlePage(int articlePage) {
86          _articlePage = articlePage;
87      }
88  
89      public void setXmlRequest(String xmlRequest) {
90          _xmlRequest = xmlRequest;
91      }
92  
93      public void setShowTitle(boolean showTitle) {
94          _showTitle = showTitle;
95      }
96  
97      public void setShowAvailableLocales(boolean showAvailableLocales) {
98          _showAvailableLocales = showAvailableLocales;
99      }
100 
101     protected String getDefaultPage() {
102         return _PAGE;
103     }
104 
105     private static final String _PAGE =
106         "/html/taglib/ui/journal_article/page.jsp";
107 
108     private long _articleResourcePrimKey;
109     private long _groupId;
110     private String _articleId;
111     private String _templateId;
112     private String _languageId;
113     private int _articlePage = 1;
114     private String _xmlRequest;
115     private boolean _showTitle;
116     private boolean _showAvailableLocales;
117 
118 }