use of com.liferay.portal.kernel.search.Indexer in project liferay-ide by liferay.
the class UserLocalServiceImpl method unsetRoleUsers.
/**
* Removes the users from the role.
*
* @param roleId the primary key of the role
* @param users the users
* @throws PortalException if a portal exception occurred
* @throws SystemException if a system exception occurred
*/
@Override
public void unsetRoleUsers(long roleId, List<User> users) throws PortalException, SystemException {
Role role = rolePersistence.findByPrimaryKey(roleId);
String roleName = role.getName();
if ((roleName.equals(RoleConstants.ADMINISTRATOR) && (getRoleUsersCount(role.getRoleId()) <= 1)) || roleName.equals(RoleConstants.USER)) {
return;
}
rolePersistence.removeUsers(roleId, users);
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(User.class);
indexer.reindex(users);
PermissionCacheUtil.clearCache();
}
use of com.liferay.portal.kernel.search.Indexer in project liferay-ide by liferay.
the class SongLocalServiceImpl method moveSongFromTrash.
@Override
public Song moveSongFromTrash(long userId, long songId, long albumId) throws PortalException, SystemException {
Song song = getSong(songId);
TrashEntry trashEntry = song.getTrashEntry();
if (trashEntry.isTrashEntry(Song.class, songId)) {
restoreSongFromTrash(userId, songId);
} else {
// Entry
TrashVersion trashVersion = trashVersionLocalService.fetchVersion(trashEntry.getEntryId(), Song.class.getName(), songId);
int status = WorkflowConstants.STATUS_APPROVED;
if (trashVersion != null) {
status = trashVersion.getStatus();
}
ServiceContext serviceContext = new ServiceContext();
// Entry
User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date();
song.setModifiedDate(serviceContext.getModifiedDate(now));
song.setStatus(status);
song.setStatusByUserId(user.getUserId());
song.setStatusByUserName(user.getFullName());
song.setStatusDate(serviceContext.getModifiedDate(now));
songPersistence.update(song);
// Asset
assetEntryLocalService.updateVisible(Song.class.getName(), song.getSongId(), false);
// Indexer
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(Song.class);
indexer.reindex(song);
if (trashVersion != null) {
trashVersionLocalService.deleteTrashVersion(trashVersion);
}
}
return songLocalService.moveSong(songId, albumId);
}
use of com.liferay.portal.kernel.search.Indexer in project liferay-ide by liferay.
the class UserLocalServiceImpl method addOrganizationUsers.
/**
* Adds the users to the organization.
*
* @param organizationId the primary key of the organization
* @param userIds the primary keys of the users
* @throws PortalException if an organization or user with the primary key
* could not be found
* @throws SystemException if a system exception occurred
*/
@Override
public void addOrganizationUsers(long organizationId, long[] userIds) throws PortalException, SystemException {
organizationPersistence.addUsers(organizationId, userIds);
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(User.class);
indexer.reindex(userIds);
PermissionCacheUtil.clearCache();
}
use of com.liferay.portal.kernel.search.Indexer in project liferay-ide by liferay.
the class UserLocalServiceImpl method reindex.
protected void reindex(final User user) {
final Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(User.class);
Callable<Void> callable = new ShardCallable<Void>(user.getCompanyId()) {
@Override
protected Void doCall() throws Exception {
indexer.reindex(user);
return null;
}
};
TransactionCommitCallbackRegistryUtil.registerCallback(callable);
}
use of com.liferay.portal.kernel.search.Indexer in project liferay-ide by liferay.
the class UserLocalServiceImpl method addTeamUsers.
/**
* Adds the users to the team.
*
* @param teamId the primary key of the team
* @param userIds the primary keys of the users
* @throws PortalException if a team or user with the primary key could not
* be found
* @throws SystemException if a system exception occurred
*/
@Override
public void addTeamUsers(long teamId, long[] userIds) throws PortalException, SystemException {
teamPersistence.addUsers(teamId, userIds);
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(User.class);
indexer.reindex(userIds);
PermissionCacheUtil.clearCache();
}
Aggregations