Search in sources :

Example 6 with ThemeDisplay

use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.

the class MeetupsPortlet method updateMeetupsRegistration.

public void updateMeetupsRegistration(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    long meetupsEntryId = ParamUtil.getLong(actionRequest, "meetupsEntryId");
    int status = ParamUtil.getInteger(actionRequest, "status");
    String comments = ParamUtil.getString(actionRequest, "comments");
    MeetupsRegistrationLocalServiceUtil.updateMeetupsRegistration(themeDisplay.getUserId(), meetupsEntryId, status, comments);
}
Also used : ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Example 7 with ThemeDisplay

use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.

the class MeetupsPortlet method deleteMeetupsEntry.

public void deleteMeetupsEntry(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();
    if (!permissionChecker.isCompanyAdmin()) {
        return;
    }
    long meetupsEntryId = ParamUtil.getLong(actionRequest, "meetupsEntryId");
    MeetupsEntryLocalServiceUtil.deleteMeetupsEntry(meetupsEntryId);
}
Also used : PermissionChecker(com.liferay.portal.security.permission.PermissionChecker) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Example 8 with ThemeDisplay

use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.

the class LiferayActivityService method getThemeDisplay.

protected ThemeDisplay getThemeDisplay(SecurityToken securityToken) throws Exception {
    long userIdLong = GetterUtil.getLong(securityToken.getViewerId());
    User user = UserLocalServiceUtil.getUserById(userIdLong);
    Company company = CompanyLocalServiceUtil.getCompanyById(user.getCompanyId());
    ThemeDisplay themeDisplay = new ThemeDisplay();
    themeDisplay.setCompany(company);
    themeDisplay.setLocale(user.getLocale());
    themeDisplay.setUser(user);
    return themeDisplay;
}
Also used : Company(com.liferay.portal.model.Company) User(com.liferay.portal.model.User) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Example 9 with ThemeDisplay

use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.

the class LiferayActivityService method doGetActivities.

public RestfulCollection<Activity> doGetActivities(Set<UserId> userIds, GroupId groupId, String appId, Set<String> fields, CollectionOptions collectionOptions, SecurityToken securityToken) throws Exception {
    ThemeDisplay themeDisplay = getThemeDisplay(securityToken);
    List<Activity> activities = new ArrayList<Activity>();
    for (UserId userId : userIds) {
        long userIdLong = GetterUtil.getLong(userId.getUserId(securityToken));
        List<Activity> personActivities = getActivities(themeDisplay, userIdLong);
        activities.addAll(personActivities);
    }
    return new RestfulCollection<Activity>(activities, collectionOptions.getFirst(), activities.size(), collectionOptions.getMax());
}
Also used : UserId(org.apache.shindig.social.opensocial.spi.UserId) ArrayList(java.util.ArrayList) SocialActivity(com.liferay.portlet.social.model.SocialActivity) Activity(org.apache.shindig.social.opensocial.model.Activity) RestfulCollection(org.apache.shindig.protocol.RestfulCollection) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Example 10 with ThemeDisplay

use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.

the class LiferayActivityService method doGetActivities.

public RestfulCollection<Activity> doGetActivities(UserId userId, GroupId groupId, String appId, Set<String> fields, CollectionOptions collectionOptions, Set<String> activityIds, SecurityToken securityToken) throws Exception {
    ThemeDisplay themeDisplay = getThemeDisplay(securityToken);
    long userIdLong = GetterUtil.getLong(userId.getUserId(securityToken));
    List<Activity> activities = getActivities(themeDisplay, userIdLong);
    return new RestfulCollection<Activity>(activities, collectionOptions.getFirst(), activities.size(), collectionOptions.getMax());
}
Also used : SocialActivity(com.liferay.portlet.social.model.SocialActivity) Activity(org.apache.shindig.social.opensocial.model.Activity) RestfulCollection(org.apache.shindig.protocol.RestfulCollection) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Aggregations

ThemeDisplay (com.liferay.portal.theme.ThemeDisplay)63 PermissionChecker (com.liferay.portal.security.permission.PermissionChecker)10 ServiceContext (com.liferay.portal.service.ServiceContext)7 JSONObject (com.liferay.portal.kernel.json.JSONObject)6 PortletURL (javax.portlet.PortletURL)6 PortalException (com.liferay.portal.kernel.exception.PortalException)5 User (com.liferay.portal.model.User)5 Gadget (com.liferay.opensocial.model.Gadget)4 SystemException (com.liferay.portal.kernel.exception.SystemException)4 UploadPortletRequest (com.liferay.portal.kernel.upload.UploadPortletRequest)4 PortletConfig (javax.portlet.PortletConfig)4 KBArticle (com.liferay.knowledgebase.model.KBArticle)3 KBFolder (com.liferay.knowledgebase.model.KBFolder)3 Role (com.liferay.portal.model.Role)3 HashMap (java.util.HashMap)3 LiferayPortletURL (com.liferay.portal.kernel.portlet.LiferayPortletURL)2 FileEntry (com.liferay.portal.kernel.repository.model.FileEntry)2 Folder (com.liferay.portal.kernel.repository.model.Folder)2 Layout (com.liferay.portal.model.Layout)2 SocialActivity (com.liferay.portlet.social.model.SocialActivity)2