1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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  }