001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.social.model.impl;
016    
017    import com.liferay.portal.theme.ThemeDisplay;
018    import com.liferay.portlet.social.model.SocialActivity;
019    import com.liferay.portlet.social.model.SocialActivityFeedEntry;
020    import com.liferay.portlet.social.model.SocialActivityInterpreter;
021    
022    import java.util.HashSet;
023    import java.util.Set;
024    
025    /**
026     * @author Brian Wing Shun Chan
027     */
028    public class SocialActivityInterpreterImpl
029            implements SocialActivityInterpreter {
030    
031            public SocialActivityInterpreterImpl(
032                    String portletId, SocialActivityInterpreter activityInterpreter) {
033    
034                    _portletId = portletId;
035                    _activityInterpreter = activityInterpreter;
036    
037                    String[] classNames = _activityInterpreter.getClassNames();
038    
039                    for (String className : classNames) {
040                            _classNames.add(className);
041                    }
042            }
043    
044            public String[] getClassNames() {
045                    return _activityInterpreter.getClassNames();
046            }
047    
048            public String getPortletId() {
049                    return _portletId;
050            }
051    
052            public boolean hasClassName(String className) {
053                    if (_classNames.contains(className)) {
054                            return true;
055                    }
056                    else {
057                            return false;
058                    }
059            }
060    
061            public SocialActivityFeedEntry interpret(
062                    SocialActivity activity, ThemeDisplay themeDisplay) {
063    
064                    return _activityInterpreter.interpret(
065                            activity, themeDisplay);
066            }
067    
068            private String _portletId;
069            private SocialActivityInterpreter _activityInterpreter;
070            private Set<String> _classNames = new HashSet<String>();
071    
072    }