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.SocialRequest;
19  import com.liferay.portlet.social.model.SocialRequestFeedEntry;
20  import com.liferay.portlet.social.model.SocialRequestInterpreter;
21  
22  import java.util.HashSet;
23  import java.util.Set;
24  
25  /**
26   * <a href="SocialRequestInterpreterImpl.java.html"><b><i>View Source</i></b>
27   * </a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class SocialRequestInterpreterImpl
32      implements SocialRequestInterpreter {
33  
34      public SocialRequestInterpreterImpl(
35          String portletId, SocialRequestInterpreter requestInterpreter) {
36  
37          _portletId = portletId;
38          _requestInterpreter = requestInterpreter;
39  
40          String[] classNames = _requestInterpreter.getClassNames();
41  
42          for (String className : classNames) {
43              _classNames.add(className);
44          }
45      }
46  
47      public String[] getClassNames() {
48          return _requestInterpreter.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 SocialRequestFeedEntry interpret(
65          SocialRequest request, ThemeDisplay themeDisplay) {
66  
67          return _requestInterpreter.interpret(
68              request, themeDisplay);
69      }
70  
71      public boolean processConfirmation(
72          SocialRequest request, ThemeDisplay themeDisplay) {
73  
74          return _requestInterpreter.processConfirmation(
75              request, themeDisplay);
76      }
77  
78      public boolean processRejection(
79          SocialRequest request, ThemeDisplay themeDisplay) {
80  
81          return _requestInterpreter.processRejection(request, themeDisplay);
82      }
83  
84      private String _portletId;
85      private SocialRequestInterpreter _requestInterpreter;
86      private Set<String> _classNames = new HashSet<String>();
87  
88  }