1   /**
2    * Copyright (c) 2000-2008 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.util.PortalUtil;
29  
30  import java.util.Date;
31  
32  import javax.portlet.RenderRequest;
33  
34  /**
35   * <a href="ArticleDisplayTerms.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Brian Wing Shun Chan
38   *
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(RenderRequest renderRequest) {
67          super(renderRequest);
68  
69          groupId = ParamUtil.getLong(
70              renderRequest, GROUP_ID,
71              PortalUtil.getPortletGroupId(renderRequest));
72          articleId = ParamUtil.getString(renderRequest, ARTICLE_ID);
73          version = ParamUtil.getDouble(renderRequest, VERSION);
74          title = ParamUtil.getString(renderRequest, TITLE);
75          description = ParamUtil.getString(renderRequest, DESCRIPTION);
76          content = ParamUtil.getString(renderRequest, CONTENT);
77          type = ParamUtil.getString(renderRequest, TYPE);
78          structureId = ParamUtil.getString(renderRequest, STRUCTURE_ID);
79          templateId = ParamUtil.getString(renderRequest, TEMPLATE_ID);
80          status = ParamUtil.getString(renderRequest, 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 }