List of usage examples for com.liferay.portal.kernel.service UserLocalServiceUtil deleteOrganizationUsers
public static void deleteOrganizationUsers(long organizationId, long[] userIds)
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 *///from w w w . j a v a 2 s . co m 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); }