1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.social.model.impl;
16  
17  import com.liferay.portal.theme.ThemeDisplay;
18  import com.liferay.portlet.social.model.SocialActivity;
19  import com.liferay.portlet.social.model.SocialActivityFeedEntry;
20  import com.liferay.portlet.social.model.SocialActivityInterpreter;
21  
22  import java.util.HashSet;
23  import java.util.Set;
24  
25  /**
26   * <a href="SocialActivityInterpreterImpl.java.html"><b><i>View Source</i></b>
27   * </a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class SocialActivityInterpreterImpl
32      implements SocialActivityInterpreter {
33  
34      public SocialActivityInterpreterImpl(
35          String portletId, SocialActivityInterpreter activityInterpreter) {
36  
37          _portletId = portletId;
38          _activityInterpreter = activityInterpreter;
39  
40          String[] classNames = _activityInterpreter.getClassNames();
41  
42          for (String className : classNames) {
43              _classNames.add(className);
44          }
45      }
46  
47      public String[] getClassNames() {
48          return _activityInterpreter.getClassNames();
49      }
50  
51      public String getPortletId() {
52          return _portletId;
53      }
54  
55      public boolean hasClassName(String className) {
56          if (_classNames.contains(className)) {
57              return true;
58          }
59          else {
60              return false;
61          }
62      }
63  
64      public SocialActivityFeedEntry interpret(
65          SocialActivity activity, ThemeDisplay themeDisplay) {
66  
67          return _activityInterpreter.interpret(
68              activity, themeDisplay);
69      }
70  
71      private String _portletId;
72      private SocialActivityInterpreter _activityInterpreter;
73      private Set<String> _classNames = new HashSet<String>();
74  
75  }