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 = themeDisplay.getScopeGroupId();
74          articleId = ParamUtil.getString(portletRequest, ARTICLE_ID);
75          version = ParamUtil.getDouble(portletRequest, VERSION);
76          title = ParamUtil.getString(portletRequest, TITLE);
77          description = ParamUtil.getString(portletRequest, DESCRIPTION);
78          content = ParamUtil.getString(portletRequest, CONTENT);
79          type = ParamUtil.getString(portletRequest, TYPE);
80          structureId = ParamUtil.getString(portletRequest, STRUCTURE_ID);
81          templateId = ParamUtil.getString(portletRequest, TEMPLATE_ID);
82          status = ParamUtil.getString(portletRequest, STATUS);
83      }
84  
85      public long getGroupId() {
86          return groupId;
87      }
88  
89      public String getArticleId() {
90          return articleId;
91      }
92  
93      public double getVersion() {
94          return version;
95      }
96  
97      public String getVersionString() {
98          if (version != 0) {
99              return String.valueOf(version);
100         }
101         else {
102             return StringPool.BLANK;
103         }
104     }
105 
106     public String getTitle() {
107         return title;
108     }
109 
110     public String getDescription() {
111         return description;
112     }
113 
114     public String getContent() {
115         return content;
116     }
117 
118     public String getType() {
119         return type;
120     }
121 
122     public String getStructureId() {
123         return structureId;
124     }
125 
126     public String getTemplateId() {
127         return templateId;
128     }
129 
130     public Date getDisplayDateGT() {
131         return displayDateGT;
132     }
133 
134     public Date getDisplayDateLT() {
135         return displayDateLT;
136     }
137 
138     public String getStatus() {
139         return status;
140     }
141 
142     public void setStatus(String status) {
143         this.status = status;
144     }
145 
146     protected long groupId;
147     protected String articleId;
148     protected double version;
149     protected String title;
150     protected String description;
151     protected String content;
152     protected String type;
153     protected String structureId;
154     protected String templateId;
155     protected Date displayDateGT;
156     protected Date displayDateLT;
157     protected String status;
158 
159 }