1
14
15 package com.liferay.portlet.journal.search;
16
17 import com.liferay.portal.kernel.dao.search.DAOParamUtil;
18 import com.liferay.portal.kernel.util.ParamUtil;
19 import com.liferay.portal.kernel.workflow.StatusConstants;
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
32 public class ArticleSearchTerms extends ArticleDisplayTerms {
33
34 public ArticleSearchTerms(PortletRequest portletRequest) {
35 super(portletRequest);
36
37 ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(
38 WebKeys.THEME_DISPLAY);
39
40 groupId = ParamUtil.getLong(
41 portletRequest, GROUP_ID, themeDisplay.getScopeGroupId());
42 articleId = DAOParamUtil.getLike(portletRequest, ARTICLE_ID, false);
43 version = ParamUtil.getDouble(portletRequest, VERSION);
44 title = DAOParamUtil.getLike(portletRequest, TITLE);
45 description = DAOParamUtil.getLike(portletRequest, DESCRIPTION);
46 content = DAOParamUtil.getLike(portletRequest, CONTENT);
47 type = DAOParamUtil.getString(portletRequest, TYPE);
48 structureId = DAOParamUtil.getString(portletRequest, STRUCTURE_ID);
49 templateId = DAOParamUtil.getString(portletRequest, TEMPLATE_ID);
50 status = ParamUtil.getString(portletRequest, STATUS);
51 }
52
53 public void setGroupId(long groupId) {
54 this.groupId = groupId;
55 }
56
57 public Double getVersionObj() {
58 if (version == 0) {
59 return null;
60 }
61 else {
62 return new Double(version);
63 }
64 }
65
66 public void setType(String type) {
67 this.type = type;
68 }
69
70 public void setStructureId(String structureId) {
71 this.structureId = structureId;
72 }
73
74 public void setStatus(String status) {
75 this.status = status;
76 }
77
78 public int getStatusCode() {
79 if (status.equals("approved")) {
80 return StatusConstants.APPROVED;
81 }
82 else if (status.equals("not-approved")) {
83 return StatusConstants.PENDING;
84 }
85 else if (status.equals("expired")) {
86 return StatusConstants.EXPIRED;
87 }
88 else if (status.equals("review")) {
89 return StatusConstants.ANY;
90 }
91 else {
92 return StatusConstants.ANY;
93 }
94 }
95
96 public Date getReviewDate() {
97 if (status.equals("review")) {
98 return new Date();
99 }
100 else {
101 return null;
102 }
103 }
104
105 }