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                    ddmStructureKey = DAOParamUtil.getString(
036                            portletRequest, DDM_STRUCTURE_KEY);
037                    ddmTemplateKey = DAOParamUtil.getString(
038                            portletRequest, DDM_TEMPLATE_KEY);
039                    description = DAOParamUtil.getString(portletRequest, DESCRIPTION);
040                    status = ParamUtil.getInteger(portletRequest, STATUS);
041                    title = DAOParamUtil.getString(portletRequest, TITLE);
042                    version = ParamUtil.getDouble(portletRequest, VERSION);
043    
044                    groupId = setGroupId(portletRequest);
045            }
046    
047            public Date getReviewDate() {
048                    if (status == WorkflowConstants.STATUS_PENDING) {
049                            return new Date();
050                    }
051                    else {
052                            return null;
053                    }
054            }
055    
056            public Double getVersionObj() {
057                    if (version == 0) {
058                            return null;
059                    }
060                    else {
061                            return new Double(version);
062                    }
063            }
064    
065            public void setArticleId(String articleId) {
066                    this.articleId = articleId;
067            }
068    
069            public void setDDMStructureKey(String ddmStructureKey) {
070                    this.ddmStructureKey = ddmStructureKey;
071            }
072    
073            public void setGroupId(long groupId) {
074                    this.groupId = groupId;
075            }
076    
077            @Override
078            public void setStatus(int status) {
079                    this.status = status;
080            }
081    
082            public void setVersion(double version) {
083                    this.version = version;
084            }
085    
086    }