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.portlet.journal.search;
24  
25  import com.liferay.portal.kernel.dao.search.DisplayTerms;
26  import com.liferay.portal.kernel.util.ParamUtil;
27  import com.liferay.portal.kernel.util.StringPool;
28  import com.liferay.portal.theme.ThemeDisplay;
29  import com.liferay.portal.util.WebKeys;
30  
31  import java.util.Date;
32  
33  import javax.portlet.PortletRequest;
34  
35  /**
36   * <a href="ArticleDisplayTerms.java.html"><b><i>View Source</i></b></a>
37   *
38   * @author Brian Wing Shun Chan
39   *
40   */
41  public class ArticleDisplayTerms extends DisplayTerms {
42  
43      public static final String GROUP_ID = "groupId";
44  
45      public static final String ARTICLE_ID = "searchArticleId";
46  
47      public static final String VERSION = "version";
48  
49      public static final String TITLE = "title";
50  
51      public static final String DESCRIPTION = "description";
52  
53      public static final String CONTENT = "content";
54  
55      public static final String TYPE = "type";
56  
57      public static final String STRUCTURE_ID = "structureId";
58  
59      public static final String TEMPLATE_ID = "templateId";
60  
61      public static final String DISPLAY_DATE_GT = "displayDateGT";
62  
63      public static final String DISPLAY_DATE_LT = "displayDateLT";
64  
65      public static final String STATUS = "status";
66  
67      public ArticleDisplayTerms(PortletRequest portletRequest) {
68          super(portletRequest);
69  
70          ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(
71              WebKeys.THEME_DISPLAY);
72  
73          groupId = ParamUtil.getLong(
74              portletRequest, GROUP_ID, themeDisplay.getScopeGroupId());
75          articleId = ParamUtil.getString(portletRequest, ARTICLE_ID);
76          version = ParamUtil.getDouble(portletRequest, VERSION);
77          title = ParamUtil.getString(portletRequest, TITLE);
78          description = ParamUtil.getString(portletRequest, DESCRIPTION);
79          content = ParamUtil.getString(portletRequest, CONTENT);
80          type = ParamUtil.getString(portletRequest, TYPE);
81          structureId = ParamUtil.getString(portletRequest, STRUCTURE_ID);
82          templateId = ParamUtil.getString(portletRequest, TEMPLATE_ID);
83          status = ParamUtil.getString(portletRequest, STATUS);
84      }
85  
86      public long getGroupId() {
87          return groupId;
88      }
89  
90      public String getArticleId() {
91          return articleId;
92      }
93  
94      public double getVersion() {
95          return version;
96      }
97  
98      public String getVersionString() {
99          if (version != 0) {
100             return String.valueOf(version);
101         }
102         else {
103             return StringPool.BLANK;
104         }
105     }
106 
107     public String getTitle() {
108         return title;
109     }
110 
111     public String getDescription() {
112         return description;
113     }
114 
115     public String getContent() {
116         return content;
117     }
118 
119     public String getType() {
120         return type;
121     }
122 
123     public String getStructureId() {
124         return structureId;
125     }
126 
127     public String getTemplateId() {
128         return templateId;
129     }
130 
131     public Date getDisplayDateGT() {
132         return displayDateGT;
133     }
134 
135     public Date getDisplayDateLT() {
136         return displayDateLT;
137     }
138 
139     public String getStatus() {
140         return status;
141     }
142 
143     public void setStatus(String status) {
144         this.status = status;
145     }
146 
147     protected long groupId;
148     protected String articleId;
149     protected double version;
150     protected String title;
151     protected String description;
152     protected String content;
153     protected String type;
154     protected String structureId;
155     protected String templateId;
156     protected Date displayDateGT;
157     protected Date displayDateLT;
158     protected String status;
159 
160 }