1   /**
2    * Copyright (c) 2000-2008 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.portal.kernel.util.StringPool;
26  import com.liferay.taglib.util.IncludeTag;
27  
28  import javax.servlet.ServletRequest;
29  
30  /**
31   * <a href="JournalArticleTag.java.html"><b><i>View Source</i></b></a>
32   *
33   * @author Raymond Augé
34   *
35   */
36  public class JournalArticleTag extends IncludeTag {
37  
38      public int doStartTag() {
39          ServletRequest req = pageContext.getRequest();
40  
41          req.setAttribute(
42              "liferay-ui:journal-article:articleResourcePrimKey",
43              String.valueOf(_articleResourcePrimKey));
44          req.setAttribute("liferay-ui:journal-article:languageId", _languageId);
45          req.setAttribute(
46              "liferay-ui:journal-article:articlePage",
47              String.valueOf(_articlePage));
48          req.setAttribute("liferay-ui:journal-article:xmlRequest", _xmlRequest);
49          req.setAttribute(
50              "liferay-ui:journal-article:showTitle", String.valueOf(_showTitle));
51          req.setAttribute(
52              "liferay-ui:journal-article:showAvailableLocales",
53              String.valueOf(_showAvailableLocales));
54  
55          return EVAL_BODY_BUFFERED;
56      }
57  
58      public void setArticleResourcePrimKey(long articleResourcePrimKey) {
59          _articleResourcePrimKey = articleResourcePrimKey;
60      }
61  
62      public void setLanguageId(String languageId) {
63          _languageId = languageId;
64      }
65  
66      public void setArticlePage(int articlePage) {
67          _articlePage = articlePage;
68      }
69  
70      public void setXmlRequest(String xmlRequest) {
71          _xmlRequest = xmlRequest;
72      }
73  
74      public void setShowTitle(boolean showTitle) {
75          _showTitle = showTitle;
76      }
77  
78      public void setShowAvailableLocales(boolean showAvailableLocales) {
79          _showAvailableLocales = showAvailableLocales;
80      }
81  
82      protected String getDefaultPage() {
83          return _PAGE;
84      }
85  
86      private static final String _PAGE =
87          "/html/taglib/ui/journal_article/page.jsp";
88  
89      private long _articleResourcePrimKey;
90      private String _languageId;
91      private int _articlePage = 1;
92      private String _xmlRequest = StringPool.BLANK;
93      private boolean _showTitle;
94      private boolean _showAvailableLocales;
95  
96  }