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 setStructureId(String structureId) {
73 this.structureId = structureId;
74 }
75
76 public void setStatus(String status) {
77 this.status = status;
78 }
79
80 public Boolean getApprovedObj() {
81 if (status.equals("approved")) {
82 return Boolean.TRUE;
83 }
84 else if (status.equals("not-approved")) {
85 return Boolean.FALSE;
86 }
87 else if (status.equals("expired")) {
88 return Boolean.FALSE;
89 }
90 else if (status.equals("review")) {
91 return null;
92 }
93 else {
94 return null;
95 }
96 }
97
98 public Boolean getExpiredObj() {
99 if (status.equals("approved")) {
100 return Boolean.FALSE;
101 }
102 else if (status.equals("not-approved")) {
103 return Boolean.FALSE;
104 }
105 else if (status.equals("expired")) {
106 return Boolean.TRUE;
107 }
108 else if (status.equals("review")) {
109 return Boolean.FALSE;
110 }
111 else {
112 return null;
113 }
114 }
115
116 public Date getReviewDate() {
117 if (status.equals("review")) {
118 return new Date();
119 }
120 else {
121 return null;
122 }
123 }
124
125 }