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