001    /**
002     * Copyright (c) 2000-2013 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.portlet.social.model.SocialActivity;
019    import com.liferay.taglib.util.IncludeTag;
020    
021    import java.util.List;
022    
023    import javax.servlet.http.HttpServletRequest;
024    
025    /**
026     * @author Raymond Aug??
027     */
028    public class SocialActivitiesTag extends IncludeTag {
029    
030            public void setActivities(List<SocialActivity> activities) {
031                    _activities = activities;
032            }
033    
034            public void setClassName(String className) {
035                    _className = className;
036            }
037    
038            public void setClassPK(long classPK) {
039                    _classPK = classPK;
040            }
041    
042            public void setDisplayRSSFeed(boolean displayRSSFeed) {
043                    _displayRSSFeed = displayRSSFeed;
044            }
045    
046            public void setFeedEnabled(boolean feedEnabled) {
047                    _feedEnabled = feedEnabled;
048            }
049    
050            public void setFeedLink(String feedLink) {
051                    _feedLink = feedLink;
052            }
053    
054            public void setFeedLinkMessage(String feedLinkMessage) {
055                    _feedLinkMessage = feedLinkMessage;
056            }
057    
058            public void setFeedTitle(String feedTitle) {
059                    _feedTitle = feedTitle;
060            }
061    
062            @Override
063            protected void cleanUp() {
064                    _activities = null;
065                    _className = StringPool.BLANK;
066                    _classPK = 0;
067                    _displayRSSFeed = false;
068                    _feedEnabled = false;
069                    _feedLink = StringPool.BLANK;
070                    _feedLinkMessage = StringPool.BLANK;
071                    _feedTitle = null;
072            }
073    
074            @Override
075            protected String getPage() {
076                    return _PAGE;
077            }
078    
079            @Override
080            protected void setAttributes(HttpServletRequest request) {
081                    request.setAttribute(
082                            "liferay-ui:social-activities:activities", _activities);
083                    request.setAttribute(
084                            "liferay-ui:social-activities:className", _className);
085                    request.setAttribute(
086                            "liferay-ui:social-activities:classPK", String.valueOf(_classPK));
087                    request.setAttribute(
088                            "liferay-ui:social-activities:displayRSSFeed",
089                            String.valueOf(_displayRSSFeed));
090                    request.setAttribute(
091                            "liferay-ui:social-activities:feedEnabled",
092                            String.valueOf(_feedEnabled));
093                    request.setAttribute(
094                            "liferay-ui:social-activities:feedLink", _feedLink);
095                    request.setAttribute(
096                            "liferay-ui:social-activities:feedLinkMessage", _feedLinkMessage);
097                    request.setAttribute(
098                            "liferay-ui:social-activities:feedTitle", _feedTitle);
099            }
100    
101            private static final String _PAGE =
102                    "/html/taglib/ui/social_activities/page.jsp";
103    
104            private List<SocialActivity> _activities;
105            private String _className = StringPool.BLANK;
106            private long _classPK;
107            private boolean _displayRSSFeed;
108            private boolean _feedEnabled;
109            private String _feedLink = StringPool.BLANK;
110            private String _feedLinkMessage = StringPool.BLANK;
111            private String _feedTitle;
112    
113    }