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.HtmlUtil;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.kernel.util.Validator;
020    import com.liferay.taglib.util.IncludeTag;
021    
022    import java.util.Date;
023    import java.util.Map;
024    
025    import javax.servlet.ServletContext;
026    import javax.servlet.http.HttpServletRequest;
027    
028    /**
029     * @author Sergio Gonz??lez
030     */
031    public class AppViewEntryTag extends IncludeTag {
032    
033            @Override
034            public int doStartTag() {
035                    return EVAL_BODY_INCLUDE;
036            }
037    
038            public void setActionJsp(String actionJsp) {
039                    _actionJsp = actionJsp;
040            }
041    
042            public void setActionJspServletContext(
043                    ServletContext actionJspServletContext) {
044    
045                    _actionJspServletContext = actionJspServletContext;
046            }
047    
048            public void setAssetCategoryClassName(String assetCategoryClassName) {
049                    _assetCategoryClassName = assetCategoryClassName;
050            }
051    
052            public void setAssetCategoryClassPK(long assetCategoryClassPK) {
053                    _assetCategoryClassPK = assetCategoryClassPK;
054            }
055    
056            public void setAssetTagClassName(String assetTagClassName) {
057                    _assetTagClassName = assetTagClassName;
058            }
059    
060            public void setAssetTagClassPK(long assetTagClassPK) {
061                    _assetTagClassPK = assetTagClassPK;
062            }
063    
064            public void setAuthor(String author) {
065                    _author = author;
066            }
067    
068            public void setClassTypeName(String classTypeName) {
069                    _classTypeName = classTypeName;
070            }
071    
072            public void setCreateDate(Date createDate) {
073                    _createDate = createDate;
074            }
075    
076            public void setCssClass(String cssClass) {
077                    _cssClass = cssClass;
078            }
079    
080            public void setData(Map<String, Object> data) {
081                    _data = data;
082            }
083    
084            public void setDescription(String description) {
085                    _description = HtmlUtil.unescape(description);
086            }
087    
088            public void setDisplayDate(Date displayDate) {
089                    _displayDate = displayDate;
090            }
091    
092            public void setDisplayStyle(String displayStyle) {
093                    _displayStyle = displayStyle;
094            }
095    
096            public void setExpirationDate(Date expirationDate) {
097                    _expirationDate = expirationDate;
098            }
099    
100            public void setFolder(boolean folder) {
101                    _folder = folder;
102            }
103    
104            public void setGroupId(long groupId) {
105                    _groupId = groupId;
106            }
107    
108            public void setIconCssClass(String iconCssClass) {
109                    _iconCssClass = iconCssClass;
110            }
111    
112            public void setLatestApprovedVersion(String latestApprovedVersion) {
113                    _latestApprovedVersion = latestApprovedVersion;
114            }
115    
116            public void setLatestApprovedVersionAuthor(
117                    String latestApprovedVersionAuthor) {
118    
119                    _latestApprovedVersionAuthor = latestApprovedVersionAuthor;
120            }
121    
122            public void setLocked(boolean locked) {
123                    _locked = locked;
124            }
125    
126            public void setMarkupView(String markupView) {
127                    _markupView = markupView;
128            }
129    
130            public void setModifiedDate(Date modifiedDate) {
131                    _modifiedDate = modifiedDate;
132            }
133    
134            public void setReviewDate(Date reviewDate) {
135                    _reviewDate = reviewDate;
136            }
137    
138            public void setRowCheckerId(String rowCheckerId) {
139                    _rowCheckerId = rowCheckerId;
140            }
141    
142            public void setRowCheckerName(String rowCheckerName) {
143                    _rowCheckerName = rowCheckerName;
144            }
145    
146            public void setShortcut(boolean shortcut) {
147                    _shortcut = shortcut;
148            }
149    
150            public void setShowCheckbox(boolean showCheckbox) {
151                    _showCheckbox = showCheckbox;
152            }
153    
154            public void setShowLinkTitle(boolean showLinkTitle) {
155                    _showLinkTitle = showLinkTitle;
156            }
157    
158            public void setStatus(int status) {
159                    _status = status;
160            }
161    
162            public void setThumbnailDivStyle(String thumbnailDivStyle) {
163                    _thumbnailDivStyle = thumbnailDivStyle;
164            }
165    
166            public void setThumbnailSrc(String thumbnailSrc) {
167                    _thumbnailSrc = thumbnailSrc;
168            }
169    
170            public void setThumbnailStyle(String thumbnailStyle) {
171                    _thumbnailStyle = thumbnailStyle;
172            }
173    
174            public void setTitle(String title) {
175                    _title = HtmlUtil.unescape(title);
176            }
177    
178            public void setUrl(String url) {
179                    _url = url;
180            }
181    
182            public void setVersion(String version) {
183                    _version = version;
184            }
185    
186            @Override
187            protected void cleanUp() {
188                    _actionJsp = null;
189                    _actionJspServletContext = null;
190                    _assetCategoryClassName = null;
191                    _assetCategoryClassPK = 0;
192                    _assetTagClassName = null;
193                    _assetTagClassPK = 0;
194                    _author = null;
195                    _classTypeName = null;
196                    _createDate = null;
197                    _cssClass = null;
198                    _data = null;
199                    _description = null;
200                    _displayDate = null;
201                    _displayStyle = "descriptive";
202                    _expirationDate = null;
203                    _folder = false;
204                    _groupId = 0;
205                    _iconCssClass = null;
206                    _latestApprovedVersion = null;
207                    _latestApprovedVersionAuthor = null;
208                    _locked = false;
209                    _modifiedDate = null;
210                    _reviewDate = null;
211                    _rowCheckerId = null;
212                    _rowCheckerName = null;
213                    _shortcut = false;
214                    _showCheckbox = false;
215                    _showLinkTitle = true;
216                    _status = 0;
217                    _thumbnailDivStyle = StringPool.BLANK;
218                    _thumbnailSrc = null;
219                    _thumbnailStyle = null;
220                    _title = null;
221                    _url = null;
222                    _version = null;
223                    _markupView = null;
224            }
225    
226            protected ServletContext getActionJspServletContext() {
227                    if (_actionJspServletContext != null) {
228                            return _actionJspServletContext;
229                    }
230    
231                    return servletContext;
232            }
233    
234            @Override
235            protected String getPage() {
236                    if (Validator.isNotNull(_markupView)) {
237                            return "/html/taglib/ui/app_view_entry/" + _markupView + "/" +
238                                    _displayStyle + ".jsp";
239                    }
240    
241                    return "/html/taglib/ui/app_view_entry/" + _displayStyle + ".jsp";
242            }
243    
244            @Override
245            protected boolean isCleanUpSetAttributes() {
246                    return _CLEAN_UP_SET_ATTRIBUTES;
247            }
248    
249            @Override
250            protected void setAttributes(HttpServletRequest request) {
251                    request.setAttribute("liferay-ui:app-view-entry:actionJsp", _actionJsp);
252                    request.setAttribute(
253                            "liferay-ui:app-view-entry:actionJspServletContext",
254                            getActionJspServletContext());
255                    request.setAttribute(
256                            "liferay-ui:app-view-entry:assetCategoryClassName",
257                            _assetCategoryClassName);
258                    request.setAttribute(
259                            "liferay-ui:app-view-entry:assetCategoryClassPK",
260                            _assetCategoryClassPK);
261                    request.setAttribute(
262                            "liferay-ui:app-view-entry:assetTagClassName", _assetTagClassName);
263                    request.setAttribute(
264                            "liferay-ui:app-view-entry:assetTagClassPK", _assetTagClassPK);
265                    request.setAttribute("liferay-ui:app-view-entry:author", _author);
266                    request.setAttribute(
267                            "liferay-ui:app-view-entry:classTypeName", _classTypeName);
268                    request.setAttribute(
269                            "liferay-ui:app-view-entry:createDate", _createDate);
270                    request.setAttribute("liferay-ui:app-view-entry:cssClass", _cssClass);
271                    request.setAttribute("liferay-ui:app-view-entry:data", _data);
272                    request.setAttribute(
273                            "liferay-ui:app-view-entry:description", _description);
274                    request.setAttribute(
275                            "liferay-ui:app-view-entry:displayDate", _displayDate);
276                    request.setAttribute(
277                            "liferay-ui:app-view-entry:displayStyle", _displayStyle);
278                    request.setAttribute(
279                            "liferay-ui:app-view-entry:expirationDate", _expirationDate);
280                    request.setAttribute("liferay-ui:app-view-entry:folder", _folder);
281                    request.setAttribute("liferay-ui:app-view-entry:groupId", _groupId);
282                    request.setAttribute(
283                            "liferay-ui:app-view-entry:iconCssClass", _iconCssClass);
284                    request.setAttribute(
285                            "liferay-ui:app-view-entry:latestApprovedVersion",
286                            _latestApprovedVersion);
287                    request.setAttribute(
288                            "liferay-ui:app-view-entry:latestApprovedVersionAuthor",
289                            _latestApprovedVersionAuthor);
290                    request.setAttribute("liferay-ui:app-view-entry:locked", _locked);
291                    request.setAttribute(
292                            "liferay-ui:app-view-entry:modifiedDate", _modifiedDate);
293                    request.setAttribute(
294                            "liferay-ui:app-view-entry:reviewDate", _reviewDate);
295                    request.setAttribute(
296                            "liferay-ui:app-view-entry:rowCheckerId", _rowCheckerId);
297                    request.setAttribute(
298                            "liferay-ui:app-view-entry:rowCheckerName", _rowCheckerName);
299                    request.setAttribute("liferay-ui:app-view-entry:shortcut", _shortcut);
300                    request.setAttribute(
301                            "liferay-ui:app-view-entry:showCheckbox", _showCheckbox);
302                    request.setAttribute(
303                            "liferay-ui:app-view-entry:showLinkTitle", _showLinkTitle);
304                    request.setAttribute("liferay-ui:app-view-entry:status", _status);
305                    request.setAttribute(
306                            "liferay-ui:app-view-entry:thumbnailDivStyle", _thumbnailDivStyle);
307                    request.setAttribute(
308                            "liferay-ui:app-view-entry:thumbnailSrc", _thumbnailSrc);
309                    request.setAttribute(
310                            "liferay-ui:app-view-entry:thumbnailStyle", _thumbnailStyle);
311                    request.setAttribute("liferay-ui:app-view-entry:title", _title);
312                    request.setAttribute("liferay-ui:app-view-entry:version", _version);
313                    request.setAttribute("liferay-ui:app-view-entry:url", _url);
314            }
315    
316            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
317    
318            private String _actionJsp;
319            private ServletContext _actionJspServletContext;
320            private String _assetCategoryClassName;
321            private long _assetCategoryClassPK;
322            private String _assetTagClassName;
323            private long _assetTagClassPK;
324            private String _author;
325            private String _classTypeName;
326            private Date _createDate;
327            private String _cssClass;
328            private Map<String, Object> _data;
329            private String _description;
330            private Date _displayDate;
331            private String _displayStyle = "descriptive";
332            private Date _expirationDate;
333            private boolean _folder;
334            private long _groupId;
335            private String _iconCssClass;
336            private String _latestApprovedVersion;
337            private String _latestApprovedVersionAuthor;
338            private boolean _locked;
339            private String _markupView;
340            private Date _modifiedDate;
341            private Date _reviewDate;
342            private String _rowCheckerId;
343            private String _rowCheckerName;
344            private boolean _shortcut;
345            private boolean _showCheckbox = false;
346            private boolean _showLinkTitle = true;
347            private int _status = 0;
348            private String _thumbnailDivStyle = StringPool.BLANK;
349            private String _thumbnailSrc;
350            private String _thumbnailStyle;
351            private String _title;
352            private String _url;
353            private String _version;
354    
355    }