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.portal.kernel.util.GetterUtil;
018    import com.liferay.portal.kernel.util.HtmlUtil;
019    import com.liferay.portal.kernel.util.PropsKeys;
020    import com.liferay.portal.kernel.util.PropsUtil;
021    import com.liferay.portal.kernel.util.Tuple;
022    import com.liferay.portlet.messageboards.model.MBMessage;
023    import com.liferay.taglib.util.IncludeTag;
024    
025    import java.util.List;
026    
027    import javax.servlet.http.HttpServletRequest;
028    
029    /**
030     * @author Eudaldo Alonso
031     * @author Tibor Lipusz
032     */
033    public class AppViewSearchEntryTag extends IncludeTag {
034    
035            @Override
036            public int doStartTag() {
037                    return EVAL_BODY_INCLUDE;
038            }
039    
040            public void setActionJsp(String actionJsp) {
041                    _actionJsp = actionJsp;
042            }
043    
044            public void setContainerName(String containerName) {
045                    _containerName = containerName;
046            }
047    
048            public void setContainerType(String containerType) {
049                    _containerType = containerType;
050            }
051    
052            public void setCssClass(String cssClass) {
053                    _cssClass = cssClass;
054            }
055    
056            public void setDescription(String description) {
057                    _description = HtmlUtil.unescape(description);
058            }
059    
060            public void setFileEntryTuples(List<Tuple> fileEntryTuples) {
061                    _fileEntryTuples = fileEntryTuples;
062            }
063    
064            public void setHighlightEnabled(boolean highlightEnabled) {
065                    _highlightEnabled = highlightEnabled;
066            }
067    
068            public void setLocked(boolean locked) {
069                    _locked = locked;
070            }
071    
072            public void setMbMessages(List<MBMessage> mbMessages) {
073                    _mbMessages = mbMessages;
074            }
075    
076            public void setQueryTerms(String[] queryTerms) {
077                    _queryTerms = queryTerms;
078            }
079    
080            public void setRowCheckerId(String rowCheckerId) {
081                    _rowCheckerId = rowCheckerId;
082            }
083    
084            public void setRowCheckerName(String rowCheckerName) {
085                    _rowCheckerName = rowCheckerName;
086            }
087    
088            public void setShowCheckbox(boolean showCheckbox) {
089                    _showCheckbox = showCheckbox;
090            }
091    
092            public void setStatus(int status) {
093                    _status = status;
094            }
095    
096            public void setThumbnailSrc(String thumbnailSrc) {
097                    _thumbnailSrc = thumbnailSrc;
098            }
099    
100            public void setTitle(String title) {
101                    _title = HtmlUtil.unescape(title);
102            }
103    
104            public void setUrl(String url) {
105                    _url = url;
106            }
107    
108            public void setVersions(List<String> versions) {
109                    _versions = versions;
110            }
111    
112            @Override
113            protected void cleanUp() {
114                    _actionJsp = null;
115                    _containerName = null;
116                    _containerType = null;
117                    _cssClass = null;
118                    _description = null;
119                    _fileEntryTuples = null;
120                    _highlightEnabled = _HIGHLIGHT_ENABLED;
121                    _locked = false;
122                    _mbMessages = null;
123                    _queryTerms = null;
124                    _rowCheckerId = null;
125                    _rowCheckerName = null;
126                    _showCheckbox = false;
127                    _status = 0;
128                    _thumbnailSrc = null;
129                    _title = null;
130                    _url = null;
131                    _versions = null;
132            }
133    
134            @Override
135            protected String getPage() {
136                    return _PAGE;
137            }
138    
139            @Override
140            protected boolean isCleanUpSetAttributes() {
141                    return _CLEAN_UP_SET_ATTRIBUTES;
142            }
143    
144            @Override
145            protected void setAttributes(HttpServletRequest request) {
146                    request.setAttribute(
147                            "liferay-ui:app-view-search-entry:actionJsp", _actionJsp);
148                    request.setAttribute(
149                            "liferay-ui:app-view-search-entry:containerName", _containerName);
150                    request.setAttribute(
151                            "liferay-ui:app-view-search-entry:containerType", _containerType);
152                    request.setAttribute(
153                            "liferay-ui:app-view-search-entry:cssClass", _cssClass);
154                    request.setAttribute(
155                            "liferay-ui:app-view-search-entry:description", _description);
156                    request.setAttribute(
157                            "liferay-ui:app-view-search-entry:fileEntryTuples",
158                            _fileEntryTuples);
159                    request.setAttribute(
160                            "liferay-ui:app-view-search-entry:highlightEnabled",
161                            _highlightEnabled);
162                    request.setAttribute(
163                            "liferay-ui:app-view-search-entry:locked", _locked);
164                    request.setAttribute(
165                            "liferay-ui:app-view-search-entry:mbMessages", _mbMessages);
166                    request.setAttribute(
167                            "liferay-ui:app-view-search-entry:queryTerms", _queryTerms);
168                    request.setAttribute(
169                            "liferay-ui:app-view-search-entry:rowCheckerId", _rowCheckerId);
170                    request.setAttribute(
171                            "liferay-ui:app-view-search-entry:rowCheckerName", _rowCheckerName);
172                    request.setAttribute(
173                            "liferay-ui:app-view-search-entry:showCheckbox", _showCheckbox);
174                    request.setAttribute(
175                            "liferay-ui:app-view-search-entry:status", _status);
176                    request.setAttribute(
177                            "liferay-ui:app-view-search-entry:thumbnailSrc", _thumbnailSrc);
178                    request.setAttribute("liferay-ui:app-view-search-entry:title", _title);
179                    request.setAttribute("liferay-ui:app-view-search-entry:url", _url);
180                    request.setAttribute(
181                            "liferay-ui:app-view-search-entry:versions", _versions);
182            }
183    
184            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
185    
186            private static final boolean _HIGHLIGHT_ENABLED = GetterUtil.getBoolean(
187                    PropsUtil.get(PropsKeys.INDEX_SEARCH_HIGHLIGHT_ENABLED));
188    
189            private static final String _PAGE =
190                    "/html/taglib/ui/app_view_search_entry/page.jsp";
191    
192            private String _actionJsp;
193            private String _containerName;
194            private String _containerType;
195            private String _cssClass;
196            private String _description;
197            private List<Tuple> _fileEntryTuples;
198            private boolean _highlightEnabled = _HIGHLIGHT_ENABLED;
199            private boolean _locked;
200            private List<MBMessage> _mbMessages;
201            private String[] _queryTerms;
202            private String _rowCheckerId;
203            private String _rowCheckerName;
204            private boolean _showCheckbox = false;
205            private int _status = 0;
206            private String _thumbnailSrc;
207            private String _title;
208            private String _url;
209            private List<String> _versions;
210    
211    }