001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.journal.search;
022:
023: import com.liferay.portal.kernel.dao.DAOParamUtil;
024: import com.liferay.portal.kernel.util.ParamUtil;
025: import com.liferay.portal.util.PortalUtil;
026:
027: import java.util.Date;
028:
029: import javax.portlet.RenderRequest;
030:
031: /**
032: * <a href="ArticleSearchTerms.java.html"><b><i>View Source</i></b></a>
033: *
034: * @author Brian Wing Shun Chan
035: *
036: */
037: public class ArticleSearchTerms extends ArticleDisplayTerms {
038:
039: public ArticleSearchTerms(RenderRequest req) {
040: super (req);
041:
042: groupId = ParamUtil.getLong(req, GROUP_ID, PortalUtil
043: .getPortletGroupId(req));
044: articleId = DAOParamUtil.getLike(req, ARTICLE_ID);
045: version = ParamUtil.getDouble(req, VERSION);
046: title = DAOParamUtil.getLike(req, TITLE);
047: description = DAOParamUtil.getLike(req, DESCRIPTION);
048: content = DAOParamUtil.getLike(req, CONTENT);
049: type = DAOParamUtil.getString(req, TYPE);
050: structureId = DAOParamUtil.getString(req, STRUCTURE_ID);
051: templateId = DAOParamUtil.getString(req, TEMPLATE_ID);
052: status = ParamUtil.getString(req, STATUS);
053: }
054:
055: public void setGroupId(long groupId) {
056: this .groupId = groupId;
057: }
058:
059: public Double getVersionObj() {
060: if (version == 0) {
061: return null;
062: } else {
063: return new Double(version);
064: }
065: }
066:
067: public void setType(String type) {
068: this .type = type;
069: }
070:
071: public void setStatus(String status) {
072: this .status = status;
073: }
074:
075: public Boolean getApprovedObj() {
076: if (status.equals("approved")) {
077: return Boolean.TRUE;
078: } else if (status.equals("not-approved")) {
079: return Boolean.FALSE;
080: } else if (status.equals("expired")) {
081: return Boolean.FALSE;
082: } else if (status.equals("review")) {
083: return null;
084: } else {
085: return null;
086: }
087: }
088:
089: public Boolean getExpiredObj() {
090: if (status.equals("approved")) {
091: return Boolean.FALSE;
092: } else if (status.equals("not-approved")) {
093: return Boolean.FALSE;
094: } else if (status.equals("expired")) {
095: return Boolean.TRUE;
096: } else if (status.equals("review")) {
097: return Boolean.FALSE;
098: } else {
099: return null;
100: }
101: }
102:
103: public Date getReviewDate() {
104: if (status.equals("review")) {
105: return new Date();
106: } else {
107: return null;
108: }
109: }
110:
111: }
|