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