001
014
015 package com.liferay.portlet.journal.search;
016
017 import com.liferay.portal.kernel.dao.search.DisplayTerms;
018 import com.liferay.portal.kernel.util.ParamUtil;
019 import com.liferay.portal.kernel.util.StringPool;
020 import com.liferay.portal.kernel.util.Validator;
021 import com.liferay.portal.theme.ThemeDisplay;
022 import com.liferay.portal.util.WebKeys;
023
024 import java.util.Date;
025
026 import javax.portlet.PortletRequest;
027
028
031 public class ArticleDisplayTerms extends DisplayTerms {
032
033 public static final String ARTICLE_ID = "searchArticleId";
034
035 public static final String CONTENT = "content";
036
037 public static final String DESCRIPTION = "description";
038
039 public static final String DISPLAY_DATE_GT = "displayDateGT";
040
041 public static final String DISPLAY_DATE_LT = "displayDateLT";
042
043 public static final String GROUP_ID = "groupId";
044
045 public static final String STATUS = "status";
046
047 public static final String STRUCTURE_ID = "structureId";
048
049 public static final String TEMPLATE_ID = "templateId";
050
051 public static final String TITLE = "title";
052
053 public static final String TYPE = "type";
054
055 public static final String VERSION = "version";
056
057 public ArticleDisplayTerms(PortletRequest portletRequest) {
058 super(portletRequest);
059
060 articleId = ParamUtil.getString(portletRequest, ARTICLE_ID);
061 content = ParamUtil.getString(portletRequest, CONTENT);
062 description = ParamUtil.getString(portletRequest, DESCRIPTION);
063 status = ParamUtil.getString(portletRequest, STATUS);
064 structureId = ParamUtil.getString(portletRequest, STRUCTURE_ID);
065 templateId = ParamUtil.getString(portletRequest, TEMPLATE_ID);
066 title = ParamUtil.getString(portletRequest, TITLE);
067 type = ParamUtil.getString(portletRequest, TYPE);
068 version = ParamUtil.getDouble(portletRequest, VERSION);
069
070 groupId = setGroupId(portletRequest);
071 }
072
073 public String getArticleId() {
074 return articleId;
075 }
076
077 public String getContent() {
078 return content;
079 }
080
081 public String getDescription() {
082 return description;
083 }
084
085 public Date getDisplayDateGT() {
086 return displayDateGT;
087 }
088
089 public Date getDisplayDateLT() {
090 return displayDateLT;
091 }
092
093 public long getGroupId() {
094 return groupId;
095 }
096
097 public String getStatus() {
098 return status;
099 }
100
101 public String getStructureId() {
102 return structureId;
103 }
104
105 public String getTemplateId() {
106 return templateId;
107 }
108
109 public String getTitle() {
110 return title;
111 }
112
113 public String getType() {
114 return type;
115 }
116
117 public double getVersion() {
118 return version;
119 }
120
121 public String getVersionString() {
122 if (version != 0) {
123 return String.valueOf(version);
124 }
125 else {
126 return StringPool.BLANK;
127 }
128 }
129
130 public void setDisplayDateGT(Date displayDateGT) {
131 this.displayDateGT = displayDateGT;
132 }
133
134 public void setDisplayDateLT(Date displayDateLT) {
135 this.displayDateLT = displayDateLT;
136 }
137
138 public long setGroupId(PortletRequest portletRequest) {
139 groupId = ParamUtil.getLong(portletRequest, GROUP_ID);
140
141 if ((groupId == 0) && Validator.isNull(structureId) &&
142 Validator.isNull(templateId)) {
143
144 ThemeDisplay themeDisplay =
145 (ThemeDisplay)portletRequest.getAttribute(
146 WebKeys.THEME_DISPLAY);
147
148 groupId = themeDisplay.getScopeGroupId();
149 }
150
151 return groupId;
152 }
153
154 public void setStatus(String status) {
155 this.status = status;
156 }
157
158 protected String articleId;
159 protected String content;
160 protected String description;
161 protected Date displayDateGT;
162 protected Date displayDateLT;
163 protected long groupId;
164 protected String status;
165 protected String structureId;
166 protected String templateId;
167 protected String title;
168 protected String type;
169 protected double version;
170
171 }