001
014
015 package com.liferay.portlet.journal.search;
016
017 import com.liferay.portal.kernel.dao.search.DisplayTerms;
018 import com.liferay.portal.kernel.util.ParamUtil;
019 import com.liferay.portal.kernel.util.StringPool;
020 import com.liferay.portal.kernel.util.Validator;
021 import com.liferay.portal.theme.ThemeDisplay;
022 import com.liferay.portal.util.WebKeys;
023
024 import java.util.ArrayList;
025 import java.util.Date;
026 import java.util.List;
027
028 import javax.portlet.PortletRequest;
029
030
033 public class ArticleDisplayTerms extends DisplayTerms {
034
035 public static final String ARTICLE_ID = "searchArticleId";
036
037 public static final String CONTENT = "content";
038
039 public static final String DESCRIPTION = "description";
040
041 public static final String DISPLAY_DATE_GT = "displayDateGT";
042
043 public static final String DISPLAY_DATE_LT = "displayDateLT";
044
045 public static final String FOLDER_ID = "folderId";
046
047 public static final String GROUP_ID = "groupId";
048
049 public static final String NAVIGATION = "navigation";
050
051 public static final String STATUS = "status";
052
053 public static final String STRUCTURE_ID = "structureId";
054
055 public static final String TEMPLATE_ID = "templateId";
056
057 public static final String TITLE = "title";
058
059 public static final String TYPE = "type";
060
061 public static final String VERSION = "version";
062
063 public ArticleDisplayTerms(PortletRequest portletRequest) {
064 super(portletRequest);
065
066 articleId = ParamUtil.getString(portletRequest, ARTICLE_ID);
067 content = ParamUtil.getString(portletRequest, CONTENT);
068 description = ParamUtil.getString(portletRequest, DESCRIPTION);
069 folderId = ParamUtil.getLong(portletRequest, FOLDER_ID);
070 navigation = ParamUtil.getString(portletRequest, NAVIGATION);
071 status = ParamUtil.getString(portletRequest, STATUS);
072 structureId = ParamUtil.getString(portletRequest, STRUCTURE_ID);
073 templateId = ParamUtil.getString(portletRequest, TEMPLATE_ID);
074 title = ParamUtil.getString(portletRequest, TITLE);
075 type = ParamUtil.getString(portletRequest, TYPE);
076 version = ParamUtil.getDouble(portletRequest, VERSION);
077
078 groupId = setGroupId(portletRequest);
079 }
080
081 public String getArticleId() {
082 return articleId;
083 }
084
085 public String getContent() {
086 return content;
087 }
088
089 public String getDescription() {
090 return description;
091 }
092
093 public Date getDisplayDateGT() {
094 return displayDateGT;
095 }
096
097 public Date getDisplayDateLT() {
098 return displayDateLT;
099 }
100
101 public long getFolderId() {
102 return folderId;
103 }
104
105 public List<Long> getFolderIds() {
106 if (folderIds != null) {
107 return folderIds;
108 }
109
110 List<Long> folderIds = new ArrayList<Long>();
111
112 folderIds.add(folderId);
113
114 return folderIds;
115 }
116
117 public long getGroupId() {
118 return groupId;
119 }
120
121 public String getNavigation() {
122 return navigation;
123 }
124
125 public String getStatus() {
126 return status;
127 }
128
129 public String getStructureId() {
130 return structureId;
131 }
132
133 public String getTemplateId() {
134 return templateId;
135 }
136
137 public String getTitle() {
138 return title;
139 }
140
141 public String getType() {
142 return type;
143 }
144
145 public double getVersion() {
146 return version;
147 }
148
149 public String getVersionString() {
150 if (version != 0) {
151 return String.valueOf(version);
152 }
153 else {
154 return StringPool.BLANK;
155 }
156 }
157
158 public void setDisplayDateGT(Date displayDateGT) {
159 this.displayDateGT = displayDateGT;
160 }
161
162 public void setDisplayDateLT(Date displayDateLT) {
163 this.displayDateLT = displayDateLT;
164 }
165
166 public void setFolderIds(List<Long> folderIds) {
167 this.folderIds = folderIds;
168 }
169
170 public long setGroupId(PortletRequest portletRequest) {
171 groupId = ParamUtil.getLong(portletRequest, GROUP_ID);
172
173 if ((groupId == 0) && Validator.isNull(structureId) &&
174 Validator.isNull(templateId)) {
175
176 ThemeDisplay themeDisplay =
177 (ThemeDisplay)portletRequest.getAttribute(
178 WebKeys.THEME_DISPLAY);
179
180 groupId = themeDisplay.getScopeGroupId();
181 }
182
183 return groupId;
184 }
185
186 public void setStatus(String status) {
187 this.status = status;
188 }
189
190 protected String articleId;
191 protected String content;
192 protected String description;
193 protected Date displayDateGT;
194 protected Date displayDateLT;
195 protected long folderId;
196 protected List<Long> folderIds;
197 protected long groupId;
198 protected String navigation;
199 protected String status;
200 protected String structureId;
201 protected String templateId;
202 protected String title;
203 protected String type;
204 protected double version;
205
206 }