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.staging;
016    
017    import com.liferay.taglib.util.IncludeTag;
018    
019    import java.util.Map;
020    
021    import javax.servlet.http.HttpServletRequest;
022    
023    /**
024     * @author Levente Hud??k
025     */
026    public class ContentTag extends IncludeTag {
027    
028            public void setCmd(String cmd) {
029                    _cmd = cmd;
030            }
031    
032            public void setDisableInputs(boolean disableInputs) {
033                    _disableInputs = disableInputs;
034            }
035    
036            public void setParameterMap(Map<String, String[]> parameterMap) {
037                    _parameterMap = parameterMap;
038            }
039    
040            public void setType(String type) {
041                    _type = type;
042            }
043    
044            @Override
045            protected void cleanUp() {
046                    _cmd = null;
047                    _disableInputs = false;
048                    _parameterMap = null;
049                    _type = null;
050            }
051    
052            @Override
053            protected String getPage() {
054                    return _PAGE;
055            }
056    
057            @Override
058            protected void setAttributes(HttpServletRequest request) {
059                    request.setAttribute("liferay-staging:content:cmd", _cmd);
060                    request.setAttribute(
061                            "liferay-staging:content:disableInputs", _disableInputs);
062                    request.setAttribute(
063                            "liferay-staging:content:parameterMap", _parameterMap);
064                    request.setAttribute(
065                            "liferay-staging:content:renderRequest",
066                            pageContext.getAttribute("renderRequest"));
067                    request.setAttribute("liferay-staging:content:type", _type);
068            }
069    
070            private static final String _PAGE = "/html/taglib/staging/content/page.jsp";
071    
072            private String _cmd;
073            private boolean _disableInputs;
074            private Map<String, String[]> _parameterMap;
075            private String _type;
076    
077    }