1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.journal.search;
21  
22  import com.liferay.portal.kernel.dao.search.DisplayTerms;
23  import com.liferay.portal.kernel.util.ParamUtil;
24  import com.liferay.portal.kernel.util.StringPool;
25  import com.liferay.portal.theme.ThemeDisplay;
26  import com.liferay.portal.util.WebKeys;
27  
28  import java.util.Date;
29  
30  import javax.portlet.PortletRequest;
31  
32  /**
33   * <a href="ArticleDisplayTerms.java.html"><b><i>View Source</i></b></a>
34   *
35   * @author Brian Wing Shun Chan
36   *
37   */
38  public class ArticleDisplayTerms extends DisplayTerms {
39  
40      public static final String GROUP_ID = "groupId";
41  
42      public static final String ARTICLE_ID = "searchArticleId";
43  
44      public static final String VERSION = "version";
45  
46      public static final String TITLE = "title";
47  
48      public static final String DESCRIPTION = "description";
49  
50      public static final String CONTENT = "content";
51  
52      public static final String TYPE = "type";
53  
54      public static final String STRUCTURE_ID = "structureId";
55  
56      public static final String TEMPLATE_ID = "templateId";
57  
58      public static final String DISPLAY_DATE_GT = "displayDateGT";
59  
60      public static final String DISPLAY_DATE_LT = "displayDateLT";
61  
62      public static final String STATUS = "status";
63  
64      public ArticleDisplayTerms(PortletRequest portletRequest) {
65          super(portletRequest);
66  
67          ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(
68              WebKeys.THEME_DISPLAY);
69  
70          groupId = ParamUtil.getLong(
71              portletRequest, GROUP_ID, themeDisplay.getScopeGroupId());
72          articleId = ParamUtil.getString(portletRequest, ARTICLE_ID);
73          version = ParamUtil.getDouble(portletRequest, VERSION);
74          title = ParamUtil.getString(portletRequest, TITLE);
75          description = ParamUtil.getString(portletRequest, DESCRIPTION);
76          content = ParamUtil.getString(portletRequest, CONTENT);
77          type = ParamUtil.getString(portletRequest, TYPE);
78          structureId = ParamUtil.getString(portletRequest, STRUCTURE_ID);
79          templateId = ParamUtil.getString(portletRequest, TEMPLATE_ID);
80          status = ParamUtil.getString(portletRequest, STATUS);
81      }
82  
83      public long getGroupId() {
84          return groupId;
85      }
86  
87      public String getArticleId() {
88          return articleId;
89      }
90  
91      public double getVersion() {
92          return version;
93      }
94  
95      public String getVersionString() {
96          if (version != 0) {
97              return String.valueOf(version);
98          }
99          else {
100             return StringPool.BLANK;
101         }
102     }
103 
104     public String getTitle() {
105         return title;
106     }
107 
108     public String getDescription() {
109         return description;
110     }
111 
112     public String getContent() {
113         return content;
114     }
115 
116     public String getType() {
117         return type;
118     }
119 
120     public String getStructureId() {
121         return structureId;
122     }
123 
124     public String getTemplateId() {
125         return templateId;
126     }
127 
128     public Date getDisplayDateGT() {
129         return displayDateGT;
130     }
131 
132     public Date getDisplayDateLT() {
133         return displayDateLT;
134     }
135 
136     public String getStatus() {
137         return status;
138     }
139 
140     public void setStatus(String status) {
141         this.status = status;
142     }
143 
144     protected long groupId;
145     protected String articleId;
146     protected double version;
147     protected String title;
148     protected String description;
149     protected String content;
150     protected String type;
151     protected String structureId;
152     protected String templateId;
153     protected Date displayDateGT;
154     protected Date displayDateLT;
155     protected String status;
156 
157 }