use of com.liferay.portal.kernel.messaging.Message in project liferay-ide by liferay.
the class UserLocalServiceImpl method unsetOrganizationUsers.
/**
* Removes the users from the organization.
*
* @param organizationId the primary key of the organization
* @param userIds the primary keys of the users
* @throws PortalException if a portal exception occurred
* @throws SystemException if a system exception occurred
*/
@Override
public void unsetOrganizationUsers(long organizationId, final long[] userIds) throws PortalException, SystemException {
Organization organization = organizationPersistence.findByPrimaryKey(organizationId);
final Group group = organization.getGroup();
userGroupRoleLocalService.deleteUserGroupRoles(userIds, group.getGroupId());
organizationPersistence.removeUsers(organizationId, userIds);
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(User.class);
indexer.reindex(userIds);
PermissionCacheUtil.clearCache();
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;
}
};
TransactionCommitCallbackRegistryUtil.registerCallback(callable);
}
use of com.liferay.portal.kernel.messaging.Message in project liferay-ide by liferay.
the class UserLocalServiceImpl method unsetGroupUsers.
/**
* Removes the users from the group.
*
* @param groupId the primary key of the group
* @param userIds the primary keys of the users
* @param serviceContext the service context to be applied (optionally
* <code>null</code>)
* @throws PortalException if a portal exception occurred
* @throws SystemException if a system exception occurred
*/
@Override
public void unsetGroupUsers(final long groupId, final long[] userIds, ServiceContext serviceContext) throws PortalException, SystemException {
userGroupRoleLocalService.deleteUserGroupRoles(userIds, groupId, RoleConstants.TYPE_SITE);
userLocalService.unsetGroupTeamsUsers(groupId, userIds);
groupPersistence.removeUsers(groupId, userIds);
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(User.class);
indexer.reindex(userIds);
PermissionCacheUtil.clearCache();
Callable<Void> callable = new Callable<Void>() {
@Override
public Void call() throws Exception {
Message message = new Message();
message.put("groupId", groupId);
message.put("userIds", userIds);
MessageBusUtil.sendMessage(DestinationNames.SUBSCRIPTION_CLEAN_UP, message);
return null;
}
};
TransactionCommitCallbackRegistryUtil.registerCallback(callable);
}
Aggregations