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 = ParamUtil.getLong(
49 portletRequest, GROUP_ID, themeDisplay.getScopeGroupId());
50 articleId = DAOParamUtil.getLike(portletRequest, ARTICLE_ID);
51 version = ParamUtil.getDouble(portletRequest, VERSION);
52 title = DAOParamUtil.getLike(portletRequest, TITLE);
53 description = DAOParamUtil.getLike(portletRequest, DESCRIPTION);
54 content = DAOParamUtil.getLike(portletRequest, CONTENT);
55 type = DAOParamUtil.getString(portletRequest, TYPE);
56 structureId = DAOParamUtil.getString(portletRequest, STRUCTURE_ID);
57 templateId = DAOParamUtil.getString(portletRequest, TEMPLATE_ID);
58 status = ParamUtil.getString(portletRequest, STATUS);
59 }
60
61 public void setGroupId(long groupId) {
62 this.groupId = groupId;
63 }
64
65 public Double getVersionObj() {
66 if (version == 0) {
67 return null;
68 }
69 else {
70 return new Double(version);
71 }
72 }
73
74 public void setType(String type) {
75 this.type = type;
76 }
77
78 public void setStructureId(String structureId) {
79 this.structureId = structureId;
80 }
81
82 public void setStatus(String status) {
83 this.status = status;
84 }
85
86 public Boolean getApprovedObj() {
87 if (status.equals("approved")) {
88 return Boolean.TRUE;
89 }
90 else if (status.equals("not-approved")) {
91 return Boolean.FALSE;
92 }
93 else if (status.equals("expired")) {
94 return Boolean.FALSE;
95 }
96 else if (status.equals("review")) {
97 return null;
98 }
99 else {
100 return null;
101 }
102 }
103
104 public Boolean getExpiredObj() {
105 if (status.equals("approved")) {
106 return Boolean.FALSE;
107 }
108 else if (status.equals("not-approved")) {
109 return Boolean.FALSE;
110 }
111 else if (status.equals("expired")) {
112 return Boolean.TRUE;
113 }
114 else if (status.equals("review")) {
115 return Boolean.FALSE;
116 }
117 else {
118 return null;
119 }
120 }
121
122 public Date getReviewDate() {
123 if (status.equals("review")) {
124 return new Date();
125 }
126 else {
127 return null;
128 }
129 }
130
131 }