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.taglib.ui;
016    
017    import com.liferay.taglib.util.IncludeTag;
018    
019    import javax.servlet.http.HttpServletRequest;
020    
021    /**
022     * @author Charles May
023     */
024    public class DiscussionTag extends IncludeTag {
025    
026            public void setAssetEntryVisible(boolean assetEntryVisible) {
027                    _assetEntryVisible = assetEntryVisible;
028            }
029    
030            public void setClassName(String className) {
031                    _className = className;
032            }
033    
034            public void setClassPK(long classPK) {
035                    _classPK = classPK;
036            }
037    
038            public void setFormAction(String formAction) {
039                    _formAction = formAction;
040            }
041    
042            public void setFormName(String formName) {
043                    _formName = formName;
044            }
045    
046            public void setHideControls(boolean hideControls) {
047                    _hideControls = hideControls;
048            }
049    
050            public void setPaginationURL(String paginationURL) {
051                    _paginationURL = paginationURL;
052            }
053    
054            public void setRatingsEnabled(boolean ratingsEnabled) {
055                    _ratingsEnabled = ratingsEnabled;
056            }
057    
058            public void setRedirect(String redirect) {
059                    _redirect = redirect;
060            }
061    
062            /**
063             * @deprecated As of 6.2.0, with no direct replacement
064             */
065            @Deprecated
066            public void setSubject(String subject) {
067            }
068    
069            public void setUserId(long userId) {
070                    _userId = userId;
071            }
072    
073            @Override
074            protected void cleanUp() {
075                    _assetEntryVisible = true;
076                    _className = null;
077                    _classPK = 0;
078                    _formAction = null;
079                    _formName = "fm";
080                    _hideControls = false;
081                    _paginationURL = null;
082                    _ratingsEnabled = true;
083                    _redirect = null;
084                    _userId = 0;
085            }
086    
087            @Override
088            protected String getPage() {
089                    return _PAGE;
090            }
091    
092            @Override
093            protected void setAttributes(HttpServletRequest request) {
094                    request.setAttribute(
095                            "liferay-ui:discussion:assetEntryVisible",
096                            String.valueOf(_assetEntryVisible));
097                    request.setAttribute("liferay-ui:discussion:className", _className);
098                    request.setAttribute(
099                            "liferay-ui:discussion:classPK", String.valueOf(_classPK));
100                    request.setAttribute("liferay-ui:discussion:formAction", _formAction);
101                    request.setAttribute("liferay-ui:discussion:formName", _formName);
102                    request.setAttribute(
103                            "liferay-ui:discussion:hideControls",
104                            String.valueOf(_hideControls));
105                    request.setAttribute(
106                            "liferay-ui:discussion:paginationURL", _paginationURL);
107                    request.setAttribute(
108                            "liferay-ui:discussion:ratingsEnabled",
109                            String.valueOf(_ratingsEnabled));
110                    request.setAttribute("liferay-ui:discussion:redirect", _redirect);
111                    request.setAttribute(
112                            "liferay-ui:discussion:userId", String.valueOf(_userId));
113            }
114    
115            private static final String _PAGE = "/html/taglib/ui/discussion/page.jsp";
116    
117            private boolean _assetEntryVisible = true;
118            private String _className;
119            private long _classPK;
120            private String _formAction;
121            private String _formName = "fm";
122            private boolean _hideControls;
123            private String _paginationURL;
124            private boolean _ratingsEnabled = true;
125            private String _redirect;
126            private long _userId;
127    
128    }