Example usage for com.liferay.portal.kernel.messaging DestinationNames SUBSCRIPTION_CLEAN_UP

List of usage examples for com.liferay.portal.kernel.messaging DestinationNames SUBSCRIPTION_CLEAN_UP

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.messaging DestinationNames SUBSCRIPTION_CLEAN_UP.

Prototype

String SUBSCRIPTION_CLEAN_UP

To view the source code for com.liferay.portal.kernel.messaging DestinationNames SUBSCRIPTION_CLEAN_UP.

Click Source Link

Usage

From source file:eu.gerhards.liferay.services.angular.service.impl.AngularUserServiceImpl.java

License:Open Source License

/**
 * Removes the users from the organization.
 *
 * @param organizationId the primary key of the organization
 * @param userIds the primary keys of the users
 *//*w w w  .  j  a va 2  s .c om*/
protected void unsetOrganizationUsers(long organizationId, final long[] userIds) throws PortalException {

    Organization organization = OrganizationLocalServiceUtil.getOrganization(organizationId);

    final Group group = organization.getGroup();

    UserGroupRoleLocalServiceUtil.deleteUserGroupRoles(userIds, group.getGroupId());
    UserLocalServiceUtil.deleteOrganizationUsers(organizationId, userIds);

    reindex(userIds);

    Callable<Void> callable = new Callable<Void>() {

        @Override
        public Void call() throws Exception {
            Message message = new Message();

            message.put("groupId", group.getGroupId());
            message.put("userIds", userIds);

            MessageBusUtil.sendMessage(DestinationNames.SUBSCRIPTION_CLEAN_UP, message);

            return null;
        }

    };

    TransactionCommitCallbackUtil.registerCallback(callable);
}