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