本文整理汇总了Java中com.liferay.portal.service.UserLocalServiceUtil.getRoleUsers方法的典型用法代码示例。如果您正苦于以下问题:Java UserLocalServiceUtil.getRoleUsers方法的具体用法?Java UserLocalServiceUtil.getRoleUsers怎么用?Java UserLocalServiceUtil.getRoleUsers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.service.UserLocalServiceUtil
的用法示例。
在下文中一共展示了UserLocalServiceUtil.getRoleUsers方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: receive
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
@Override
public void receive(Message message) throws MessageListenerException {
try {
this.groupId = message.getLong("groupId");
this.fileName = message.getString("fileName");
this.key = message.getString(key);
this.serviceContext = (ServiceContext)message.get("serviceContext");
this.themeDisplay = (ThemeDisplay)message.get("themeDisplay");
Role adminRole = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(),"Administrator");
List<User> adminUsers = UserLocalServiceUtil.getRoleUsers(adminRole.getRoleId());
PrincipalThreadLocal.setName(adminUsers.get(0).getUserId());
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(adminUsers.get(0));
PermissionThreadLocal.setPermissionChecker(permissionChecker);
MultiVMPoolUtil.put("exportCourseCache", key, true);
try {
doExportCourse();
} finally {
MultiVMPoolUtil.remove("exportCourseCache", key);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: receive
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
@Override
public void receive(Message message) throws MessageListenerException {
try {
this.groupId = message.getLong("groupId");
this.newCourseName = message.getString("newCourseName");
this.startDate = (Date)message.get("startDate");
this.endDate = (Date)message.get("endDate");
this.serviceContext = (ServiceContext)message.get("serviceContext");
this.themeDisplay = (ThemeDisplay)message.get("themeDisplay");
this.childCourse =(Boolean)message.get("childCourse");
this.visible = message.getBoolean("visible");
this.includeTeacher = message.getBoolean("includeTeacher");
this.cloneForum = message.getBoolean("cloneForum");
Role adminRole = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(),"Administrator");
List<User> adminUsers = UserLocalServiceUtil.getRoleUsers(adminRole.getRoleId());
PrincipalThreadLocal.setName(adminUsers.get(0).getUserId());
PermissionChecker permissionChecker =PermissionCheckerFactoryUtil.create(adminUsers.get(0), true);
PermissionThreadLocal.setPermissionChecker(permissionChecker);
doCloneCourse();
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: getAdministratorUser
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
private static User getAdministratorUser(long companyId) throws PortalException, SystemException
{
// El nombre del rol "Administrator" no puede cambiar a trav�s del UI, es un caso excepcional de s�lo lectura
// Sin embargo pueden haber varios administradores (con el rol "Administrator"),
// hacemos lo siguiente: devolvemos el que tenga userName "test" y as� tenderemos
// a devolver siempre el mismo, si no hay un administrador "test" (pues puede cambiarse) devolvemos el primero.
long adminRoleId = RoleLocalServiceUtil.getRole(companyId, "Administrator").getRoleId();
List<User> adminList = UserLocalServiceUtil.getRoleUsers(adminRoleId);
for(User user : adminList)
{
if (user.getScreenName().equals("test"))
return user;
}
return adminList.get(0); // Devolvemos el primero.
}
示例4: receive
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
@Override
public void receive(Message message) throws MessageListenerException {
try {
this.newEditionName = message.getString("newEditionName");
this.startDate = (Date)message.get("startDate");
this.endDate = (Date)message.get("endDate");
this.serviceContext = (ServiceContext)message.get("serviceContext");
this.themeDisplay = (ThemeDisplay)message.get("themeDisplay");
this.parentCourseId = (Long)message.get("parentCourseId");
this.isLinked = (Boolean)message.get("isLinked");
this.startExecutionDate = (Date) message.get("startExecutionDate");
this.endExecutionDate = (Date) message.get("endExecutionDate");
this.editionFriendlyURL = (String)message.get("editionFriendlyURL");
this.editionLayoutId = (Long)message.get("editionLayoutId");
log.debug("Parent Course Id: "+parentCourseId);
Role adminRole = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(),"Administrator");
List<User> adminUsers = UserLocalServiceUtil.getRoleUsers(adminRole.getRoleId());
PrincipalThreadLocal.setName(adminUsers.get(0).getUserId());
PermissionChecker permissionChecker =PermissionCheckerFactoryUtil.create(adminUsers.get(0));
PermissionThreadLocal.setPermissionChecker(permissionChecker);
doCreateEdition();
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: getDefaultAdmin
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
public static User getDefaultAdmin(long companyId) {
User result = null;
Role role = null;
try {
role = RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR);
List<User> admins = UserLocalServiceUtil.getRoleUsers(role.getRoleId());
if (admins != null && admins.size() > 0)
result = admins.get(0);
} catch (final Exception e) {
m_objLog.error("Utils::getAdmin Exception", e);
}
return result;
}
示例6: add
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
public void add(long companyId, long groupId, long userId, String name, String description, ServiceContext serviceContext)
throws SystemException {
long id = counterLocalService.increment(SiteRequest.class.getName());
SiteRequest siteRequest = siteRequestPersistence.create(id);
siteRequest.setCompanyId(companyId);
siteRequest.setGroupId(groupId);
siteRequest.setUserId(userId);
siteRequest.setName(name);
siteRequest.setDescription(description);
Date now = new Date();
siteRequest.setCreateDate(now);
siteRequest.setModifiedDate(now);
siteRequest.setStatus(MicroSiteConstants.REQUEST_STATUS_PENDING);
siteRequestPersistence.update(siteRequest);
JSONObject notificationEventJSONObject = JSONFactoryUtil.createJSONObject();
notificationEventJSONObject.put("siteRequestId", id);
notificationEventJSONObject.put("userId", siteRequest.getUserId());
notificationEventJSONObject.put("notificationType", MicroSiteConstants.REQUEST_STATUS_PENDING);
notificationEventJSONObject.put("siteRequestName", siteRequest.getName());
notificationEventJSONObject.put("siteRequestDescription", siteRequest.getDescription());
try {
Role role = RoleLocalServiceUtil.getRole(CompanyThreadLocal.getCompanyId(), "MICROSITE_REQUESTS_MANAGER");
if (Validator.isNotNull(role)) {
List<User> users = UserLocalServiceUtil.getRoleUsers(role.getRoleId());
for (User adminUser : users) {
UserNotificationEventLocalServiceUtil.addUserNotificationEvent(adminUser.getUserId(),
MicrositeNotificationHandler.MICROSITES_PORTLET_ID, new Date().getTime(), siteRequest.getUserId(),
notificationEventJSONObject.toString(), false, serviceContext);
}
}
} catch (Exception e) {
_log.error(e.getMessage());
}
}