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