Search in sources :

Example 1 with ActivityImpl

use of org.apache.shindig.social.core.model.ActivityImpl 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;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ActivityImpl(org.apache.shindig.social.core.model.ActivityImpl) ServiceContext(com.liferay.portal.service.ServiceContext) SocialActivity(com.liferay.portlet.social.model.SocialActivity) Activity(org.apache.shindig.social.opensocial.model.Activity) SocialActivityFeedEntry(com.liferay.portlet.social.model.SocialActivityFeedEntry)

Example 2 with ActivityImpl

use of org.apache.shindig.social.core.model.ActivityImpl 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;
}
Also used : ActivityImpl(org.apache.shindig.social.core.model.ActivityImpl) JSONObject(com.liferay.portal.kernel.json.JSONObject) SocialActivity(com.liferay.portlet.social.model.SocialActivity) Activity(org.apache.shindig.social.opensocial.model.Activity)

Aggregations

SocialActivity (com.liferay.portlet.social.model.SocialActivity)2 ActivityImpl (org.apache.shindig.social.core.model.ActivityImpl)2 Activity (org.apache.shindig.social.opensocial.model.Activity)2 JSONObject (com.liferay.portal.kernel.json.JSONObject)1 ServiceContext (com.liferay.portal.service.ServiceContext)1 SocialActivityFeedEntry (com.liferay.portlet.social.model.SocialActivityFeedEntry)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1