1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.journal.search;
16  
17  import com.liferay.portal.kernel.dao.search.DisplayTerms;
18  import com.liferay.portal.kernel.util.ParamUtil;
19  import com.liferay.portal.kernel.util.StringPool;
20  import com.liferay.portal.theme.ThemeDisplay;
21  import com.liferay.portal.util.WebKeys;
22  
23  import java.util.Date;
24  
25  import javax.portlet.PortletRequest;
26  
27  /**
28   * <a href="ArticleDisplayTerms.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Brian Wing Shun Chan
31   */
32  public class ArticleDisplayTerms extends DisplayTerms {
33  
34      public static final String GROUP_ID = "groupId";
35  
36      public static final String ARTICLE_ID = "searchArticleId";
37  
38      public static final String VERSION = "version";
39  
40      public static final String TITLE = "title";
41  
42      public static final String DESCRIPTION = "description";
43  
44      public static final String CONTENT = "content";
45  
46      public static final String TYPE = "type";
47  
48      public static final String STRUCTURE_ID = "structureId";
49  
50      public static final String TEMPLATE_ID = "templateId";
51  
52      public static final String DISPLAY_DATE_GT = "displayDateGT";
53  
54      public static final String DISPLAY_DATE_LT = "displayDateLT";
55  
56      public static final String STATUS = "status";
57  
58      public ArticleDisplayTerms(PortletRequest portletRequest) {
59          super(portletRequest);
60  
61          ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(
62              WebKeys.THEME_DISPLAY);
63  
64          groupId = ParamUtil.getLong(
65              portletRequest, GROUP_ID, themeDisplay.getScopeGroupId());
66          articleId = ParamUtil.getString(portletRequest, ARTICLE_ID);
67          version = ParamUtil.getDouble(portletRequest, VERSION);
68          title = ParamUtil.getString(portletRequest, TITLE);
69          description = ParamUtil.getString(portletRequest, DESCRIPTION);
70          content = ParamUtil.getString(portletRequest, CONTENT);
71          type = ParamUtil.getString(portletRequest, TYPE);
72          structureId = ParamUtil.getString(portletRequest, STRUCTURE_ID);
73          templateId = ParamUtil.getString(portletRequest, TEMPLATE_ID);
74          status = ParamUtil.getString(portletRequest, STATUS);
75      }
76  
77      public long getGroupId() {
78          return groupId;
79      }
80  
81      public String getArticleId() {
82          return articleId;
83      }
84  
85      public double getVersion() {
86          return version;
87      }
88  
89      public String getVersionString() {
90          if (version != 0) {
91              return String.valueOf(version);
92          }
93          else {
94              return StringPool.BLANK;
95          }
96      }
97  
98      public String getTitle() {
99          return title;
100     }
101 
102     public String getDescription() {
103         return description;
104     }
105 
106     public String getContent() {
107         return content;
108     }
109 
110     public String getType() {
111         return type;
112     }
113 
114     public String getStructureId() {
115         return structureId;
116     }
117 
118     public String getTemplateId() {
119         return templateId;
120     }
121 
122     public Date getDisplayDateGT() {
123         return displayDateGT;
124     }
125 
126     public void setDisplayDateGT(Date displayDateGT) {
127         this.displayDateGT = displayDateGT;
128     }
129 
130     public Date getDisplayDateLT() {
131         return displayDateLT;
132     }
133 
134     public void setDisplayDateLT(Date displayDateLT) {
135         this.displayDateLT = 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 }