1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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  public class ArticleDisplayTerms extends DisplayTerms {
41  
42      public static final String GROUP_ID = "groupId";
43  
44      public static final String ARTICLE_ID = "searchArticleId";
45  
46      public static final String VERSION = "version";
47  
48      public static final String TITLE = "title";
49  
50      public static final String DESCRIPTION = "description";
51  
52      public static final String CONTENT = "content";
53  
54      public static final String TYPE = "type";
55  
56      public static final String STRUCTURE_ID = "structureId";
57  
58      public static final String TEMPLATE_ID = "templateId";
59  
60      public static final String DISPLAY_DATE_GT = "displayDateGT";
61  
62      public static final String DISPLAY_DATE_LT = "displayDateLT";
63  
64      public static final String STATUS = "status";
65  
66      public ArticleDisplayTerms(PortletRequest portletRequest) {
67          super(portletRequest);
68  
69          ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(
70              WebKeys.THEME_DISPLAY);
71  
72          groupId = ParamUtil.getLong(
73              portletRequest, GROUP_ID, 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 void setDisplayDateGT(Date displayDateGT) {
135         this.displayDateGT = displayDateGT;
136     }
137 
138     public Date getDisplayDateLT() {
139         return displayDateLT;
140     }
141 
142     public void setDisplayDateLT(Date displayDateLT) {
143         this.displayDateLT = displayDateLT;
144     }
145 
146     public String getStatus() {
147         return status;
148     }
149 
150     public void setStatus(String status) {
151         this.status = status;
152     }
153 
154     protected long groupId;
155     protected String articleId;
156     protected double version;
157     protected String title;
158     protected String description;
159     protected String content;
160     protected String type;
161     protected String structureId;
162     protected String templateId;
163     protected Date displayDateGT;
164     protected Date displayDateLT;
165     protected String status;
166 
167 }