Example usage for com.liferay.portal.liveusers LiveUsers leaveGroup

List of usage examples for com.liferay.portal.liveusers LiveUsers leaveGroup

Introduction

In this page you can find the example usage for com.liferay.portal.liveusers LiveUsers leaveGroup.

Prototype

public static void leaveGroup(long companyId, long groupId, long[] userIds) 

Source Link

Usage

From source file:com.liferay.portlet.sites.action.EditGroupAssignmentsAction.java

License:Open Source License

protected void updateGroupUsers(ActionRequest actionRequest) throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    long groupId = ParamUtil.getLong(actionRequest, "groupId");

    long[] addUserIds = StringUtil.split(ParamUtil.getString(actionRequest, "addUserIds"), 0L);
    long[] removeUserIds = StringUtil.split(ParamUtil.getString(actionRequest, "removeUserIds"), 0L);

    ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);

    UserServiceUtil.addGroupUsers(groupId, addUserIds, serviceContext);
    UserServiceUtil.unsetGroupUsers(groupId, removeUserIds, serviceContext);

    LiveUsers.joinGroup(themeDisplay.getCompanyId(), groupId, addUserIds);
    LiveUsers.leaveGroup(themeDisplay.getCompanyId(), groupId, removeUserIds);
}

From source file:com.liferay.site.admin.web.internal.portlet.SiteAdminPortlet.java

License:Open Source License

public void editGroupAssignments(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    long groupId = ParamUtil.getLong(actionRequest, "groupId");

    long[] removeUserIds = StringUtil.split(ParamUtil.getString(actionRequest, "removeUserIds"), 0L);

    removeUserIds = filterRemoveUserIds(groupId, removeUserIds);

    ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);

    userService.unsetGroupUsers(groupId, removeUserIds, serviceContext);

    LiveUsers.leaveGroup(themeDisplay.getCompanyId(), groupId, removeUserIds);
}

From source file:com.liferay.site.memberships.web.internal.portlet.SiteMembershipsPortlet.java

License:Open Source License

public void deleteGroupUsers(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    Group group = _getGroup(actionRequest, actionResponse);

    long groupId = group.getGroupId();

    long[] removeUserIds = null;

    long removeUserId = ParamUtil.getLong(actionRequest, "removeUserId");

    if (removeUserId > 0) {
        removeUserIds = new long[] { removeUserId };
    } else {//  w w  w. j  a  v  a 2 s  . com
        removeUserIds = ParamUtil.getLongValues(actionRequest, "rowIds");
    }

    removeUserIds = filterRemoveUserIds(groupId, removeUserIds);

    ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);

    _userService.unsetGroupUsers(groupId, removeUserIds, serviceContext);

    LiveUsers.leaveGroup(group.getCompanyId(), groupId, removeUserIds);
}

From source file:com.liferay.site.my.sites.web.internal.portlet.MySitesPortlet.java

License:Open Source License

public void updateGroupUsers(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    long groupId = ParamUtil.getLong(actionRequest, "groupId");

    long[] addUserIds = StringUtil.split(ParamUtil.getString(actionRequest, "addUserIds"), 0L);

    addUserIds = filterAddUserIds(groupId, addUserIds);

    long[] removeUserIds = StringUtil.split(ParamUtil.getString(actionRequest, "removeUserIds"), 0L);

    removeUserIds = filterRemoveUserIds(groupId, removeUserIds);

    ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);

    _userService.addGroupUsers(groupId, addUserIds, serviceContext);
    _userService.unsetGroupUsers(groupId, removeUserIds, serviceContext);

    LiveUsers.joinGroup(themeDisplay.getCompanyId(), groupId, addUserIds);
    LiveUsers.leaveGroup(themeDisplay.getCompanyId(), groupId, removeUserIds);
}