001
014
015 package com.liferay.portlet.social.model.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.security.permission.PermissionChecker;
020 import com.liferay.portal.service.ServiceContext;
021 import com.liferay.portlet.social.model.SocialActivity;
022 import com.liferay.portlet.social.model.SocialActivityFeedEntry;
023 import com.liferay.portlet.social.model.SocialActivityInterpreter;
024 import com.liferay.portlet.social.model.SocialActivitySet;
025
026 import java.util.HashSet;
027 import java.util.Set;
028
029
032 public class SocialActivityInterpreterImpl
033 implements SocialActivityInterpreter {
034
035 public SocialActivityInterpreterImpl(
036 String portletId, SocialActivityInterpreter activityInterpreter) {
037
038 _portletId = portletId;
039 _activityInterpreter = activityInterpreter;
040
041 String[] classNames = _activityInterpreter.getClassNames();
042
043 for (String className : classNames) {
044 _classNames.add(className);
045 }
046 }
047
048 @Override
049 public String[] getClassNames() {
050 return _activityInterpreter.getClassNames();
051 }
052
053 public String getPortletId() {
054 return _portletId;
055 }
056
057 @Override
058 public String getSelector() {
059 return _activityInterpreter.getSelector();
060 }
061
062 public boolean hasClassName(String className) {
063 if (_classNames.contains(className)) {
064 return true;
065 }
066 else {
067 return false;
068 }
069 }
070
071 @Override
072 public boolean hasPermission(
073 PermissionChecker permissionChecker, SocialActivity activity,
074 String actionId, ServiceContext serviceContext)
075 throws Exception {
076
077 return _activityInterpreter.hasPermission(
078 permissionChecker, activity, actionId, serviceContext);
079 }
080
081 @Override
082 public SocialActivityFeedEntry interpret(
083 SocialActivity activity, ServiceContext serviceContext) {
084
085 return _activityInterpreter.interpret(activity, serviceContext);
086 }
087
088 @Override
089 public SocialActivityFeedEntry interpret(
090 SocialActivitySet activitySet, ServiceContext serviceContext) {
091
092 return _activityInterpreter.interpret(activitySet, serviceContext);
093 }
094
095 @Override
096 public void updateActivitySet(long activityId)
097 throws PortalException, SystemException {
098
099 _activityInterpreter.updateActivitySet(activityId);
100 }
101
102 private SocialActivityInterpreter _activityInterpreter;
103 private Set<String> _classNames = new HashSet<String>();
104 private String _portletId;
105
106 }