use of com.liferay.portlet.social.model.SocialActivity in project liferay-ide by liferay.
the class LiferayActivityService method getActivity.
protected Activity getActivity(ThemeDisplay themeDisplay, SocialActivity socialActivity) throws Exception {
Activity activity = null;
String className = socialActivity.getClassName();
if (className.equals(Activity.class.getName())) {
activity = getExternalActivity(socialActivity);
} else {
activity = new ActivityImpl(String.valueOf(socialActivity.getClassPK()), String.valueOf(socialActivity.getUserId()));
HttpServletRequest request = HttpServletRequestThreadLocal.getHttpServletRequest();
request.setAttribute(WebKeys.THEME_DISPLAY, themeDisplay);
ServiceContext serviceContext = ServiceContextFactory.getInstance(request);
serviceContext.setCompanyId(themeDisplay.getCompanyId());
serviceContext.setUserId(themeDisplay.getUserId());
SocialActivityFeedEntry socialActivityFeedEntry = SocialActivityInterpreterLocalServiceUtil.interpret(StringPool.BLANK, socialActivity, serviceContext);
activity.setBody(socialActivityFeedEntry.getBody());
activity.setTitle(socialActivityFeedEntry.getTitle());
activity.setUrl(socialActivityFeedEntry.getLink());
}
return activity;
}
use of com.liferay.portlet.social.model.SocialActivity in project liferay-ide by liferay.
the class LiferayActivityService method getActivities.
protected List<Activity> getActivities(ThemeDisplay themeDisplay, long userId) throws Exception {
List<Activity> activities = new ArrayList<Activity>();
List<SocialActivity> socialActivities = SocialActivityLocalServiceUtil.getUserActivities(userId, 0, 20);
for (SocialActivity socialActivity : socialActivities) {
Activity activity = getActivity(themeDisplay, socialActivity);
activities.add(activity);
}
return activities;
}
use of com.liferay.portlet.social.model.SocialActivity in project liferay-ide by liferay.
the class LiferayActivityService method getExternalActivity.
protected Activity getExternalActivity(SocialActivity socialActivity) throws Exception {
Activity activity = new ActivityImpl(String.valueOf(socialActivity.getClassPK()), String.valueOf(socialActivity.getUserId()));
JSONObject extraDataJSONObject = JSONFactoryUtil.createJSONObject(socialActivity.getExtraData());
SerializerUtil.copyProperties(extraDataJSONObject, activity, _ACTIVITY_FIELDS);
return activity;
}
use of com.liferay.portlet.social.model.SocialActivity in project liferay-ide by liferay.
the class LiferayActivityService method doGetActivity.
public Activity doGetActivity(UserId userId, GroupId groupId, String appId, Set<String> fields, String activityId, SecurityToken securityToken) throws Exception {
ThemeDisplay themeDisplay = getThemeDisplay(securityToken);
long activityIdLong = GetterUtil.getLong(activityId);
SocialActivity socialActivity = SocialActivityLocalServiceUtil.getActivity(activityIdLong);
return getActivity(themeDisplay, socialActivity);
}
Aggregations