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