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