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
39 public class ArticleSearchTerms extends ArticleDisplayTerms {
40
41 public ArticleSearchTerms(PortletRequest portletRequest) {
42 super(portletRequest);
43
44 ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(
45 WebKeys.THEME_DISPLAY);
46
47 groupId = ParamUtil.getLong(
48 portletRequest, GROUP_ID, 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 setStructureId(String structureId) {
78 this.structureId = structureId;
79 }
80
81 public void setStatus(String status) {
82 this.status = status;
83 }
84
85 public Boolean getApprovedObj() {
86 if (status.equals("approved")) {
87 return Boolean.TRUE;
88 }
89 else if (status.equals("not-approved")) {
90 return Boolean.FALSE;
91 }
92 else if (status.equals("expired")) {
93 return Boolean.FALSE;
94 }
95 else if (status.equals("review")) {
96 return null;
97 }
98 else {
99 return null;
100 }
101 }
102
103 public Boolean getExpiredObj() {
104 if (status.equals("approved")) {
105 return Boolean.FALSE;
106 }
107 else if (status.equals("not-approved")) {
108 return Boolean.FALSE;
109 }
110 else if (status.equals("expired")) {
111 return Boolean.TRUE;
112 }
113 else if (status.equals("review")) {
114 return Boolean.FALSE;
115 }
116 else {
117 return null;
118 }
119 }
120
121 public Date getReviewDate() {
122 if (status.equals("review")) {
123 return new Date();
124 }
125 else {
126 return null;
127 }
128 }
129
130 }