001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.journal.search;
016    
017    import com.liferay.portal.kernel.dao.search.DAOParamUtil;
018    import com.liferay.portal.kernel.util.ParamUtil;
019    import com.liferay.portal.kernel.workflow.WorkflowConstants;
020    
021    import java.util.Date;
022    
023    import javax.portlet.PortletRequest;
024    
025    /**
026     * @author Brian Wing Shun Chan
027     */
028    public class ArticleSearchTerms extends ArticleDisplayTerms {
029    
030            public ArticleSearchTerms(PortletRequest portletRequest) {
031                    super(portletRequest);
032    
033                    articleId = DAOParamUtil.getString(portletRequest, ARTICLE_ID);
034                    content = DAOParamUtil.getString(portletRequest, CONTENT);
035                    description = DAOParamUtil.getString(portletRequest, DESCRIPTION);
036                    status = ParamUtil.getInteger(portletRequest, STATUS);
037                    structureId = DAOParamUtil.getString(portletRequest, STRUCTURE_ID);
038                    templateId = DAOParamUtil.getString(portletRequest, TEMPLATE_ID);
039                    title = DAOParamUtil.getString(portletRequest, TITLE);
040                    type = DAOParamUtil.getString(portletRequest, TYPE);
041                    version = ParamUtil.getDouble(portletRequest, VERSION);
042    
043                    groupId = setGroupId(portletRequest);
044            }
045    
046            public Date getReviewDate() {
047                    if (status == WorkflowConstants.STATUS_PENDING) {
048                            return new Date();
049                    }
050                    else {
051                            return null;
052                    }
053            }
054    
055            public Double getVersionObj() {
056                    if (version == 0) {
057                            return null;
058                    }
059                    else {
060                            return new Double(version);
061                    }
062            }
063    
064            public void setArticleId(String articleId) {
065                    this.articleId = articleId;
066            }
067    
068            public void setGroupId(long groupId) {
069                    this.groupId = groupId;
070            }
071    
072            @Override
073            public void setStatus(int status) {
074                    this.status = status;
075            }
076    
077            public void setStructureId(String structureId) {
078                    this.structureId = structureId;
079            }
080    
081            public void setType(String type) {
082                    this.type = type;
083            }
084    
085            public void setVersion(double version) {
086                    this.version = version;
087            }
088    
089    }