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.theme.ThemeDisplay;
20 import com.liferay.portal.util.WebKeys;
21
22 import java.util.Date;
23
24 import javax.portlet.PortletRequest;
25
26
31 public class ArticleSearchTerms extends ArticleDisplayTerms {
32
33 public ArticleSearchTerms(PortletRequest portletRequest) {
34 super(portletRequest);
35
36 ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(
37 WebKeys.THEME_DISPLAY);
38
39 groupId = ParamUtil.getLong(
40 portletRequest, GROUP_ID, themeDisplay.getScopeGroupId());
41 articleId = DAOParamUtil.getLike(portletRequest, ARTICLE_ID, false);
42 version = ParamUtil.getDouble(portletRequest, VERSION);
43 title = DAOParamUtil.getLike(portletRequest, TITLE);
44 description = DAOParamUtil.getLike(portletRequest, DESCRIPTION);
45 content = DAOParamUtil.getLike(portletRequest, CONTENT);
46 type = DAOParamUtil.getString(portletRequest, TYPE);
47 structureId = DAOParamUtil.getString(portletRequest, STRUCTURE_ID);
48 templateId = DAOParamUtil.getString(portletRequest, TEMPLATE_ID);
49 status = ParamUtil.getString(portletRequest, STATUS);
50 }
51
52 public void setGroupId(long groupId) {
53 this.groupId = groupId;
54 }
55
56 public Double getVersionObj() {
57 if (version == 0) {
58 return null;
59 }
60 else {
61 return new Double(version);
62 }
63 }
64
65 public void setType(String type) {
66 this.type = type;
67 }
68
69 public void setStructureId(String structureId) {
70 this.structureId = structureId;
71 }
72
73 public void setStatus(String status) {
74 this.status = status;
75 }
76
77 public Boolean getApprovedObj() {
78 if (status.equals("approved")) {
79 return Boolean.TRUE;
80 }
81 else if (status.equals("not-approved")) {
82 return Boolean.FALSE;
83 }
84 else if (status.equals("expired")) {
85 return Boolean.FALSE;
86 }
87 else if (status.equals("review")) {
88 return null;
89 }
90 else {
91 return null;
92 }
93 }
94
95 public Boolean getExpiredObj() {
96 if (status.equals("approved")) {
97 return Boolean.FALSE;
98 }
99 else if (status.equals("not-approved")) {
100 return Boolean.FALSE;
101 }
102 else if (status.equals("expired")) {
103 return Boolean.TRUE;
104 }
105 else if (status.equals("review")) {
106 return Boolean.FALSE;
107 }
108 else {
109 return null;
110 }
111 }
112
113 public Date getReviewDate() {
114 if (status.equals("review")) {
115 return new Date();
116 }
117 else {
118 return null;
119 }
120 }
121
122 }