当前位置: 首页>>代码示例>>Java>>正文


Java UserLocalServiceUtil类代码示例

本文整理汇总了Java中com.liferay.portal.service.UserLocalServiceUtil的典型用法代码示例。如果您正苦于以下问题:Java UserLocalServiceUtil类的具体用法?Java UserLocalServiceUtil怎么用?Java UserLocalServiceUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UserLocalServiceUtil类属于com.liferay.portal.service包,在下文中一共展示了UserLocalServiceUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createOrUpdateUser

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
@Override
public String createOrUpdateUser(long companyId, String emailAddress, String firstName, String lastName) {

    try {
        User user = UserLocalServiceUtil.fetchUserByEmailAddress(companyId, emailAddress);

        if (user == null) {
            LOG.debug("No Liferay user found with email address " + emailAddress + ", will create one.");
            user = addUser(companyId, emailAddress, firstName, lastName);
        } else {
            LOG.debug("User found, updating name details with info from userinfo");
            updateUser(user, firstName, lastName);
        }
        return String.valueOf(user.getUserId());

    } catch (SystemException | PortalException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:finalist,项目名称:liferay-oidc-plugin,代码行数:20,代码来源:Liferay62Adapter.java

示例2: delete

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
public void delete(ActionRequest request, ActionResponse response)
		throws Exception {
	long deleteId = ParamUtil.getLong(request,EmployeeKeys.BaseEmployeeAttributes.DELETE_ID,
			PortletKeys.LONG_DEFAULT);
	Employee employee = EmployeeLocalServiceUtil.getEmployee(deleteId);
	if (employee.getMappingUserId() != PortletKeys.LONG_DEFAULT){
		User user = UserLocalServiceUtil.deleteUser(employee.getMappingUserId());
		ManagerLdap ld = new ManagerLdap();
		ServiceContext serviceContext = ServiceContextThreadLocal
				.getServiceContext();
		ld.changeActive(serviceContext, user, 0);
	}
	EmployeeLocalServiceUtil.removeEmployee(deleteId);
	response.sendRedirect(ParamUtil.getString(request,
			PortletKeys.REDIRECT_PAGE));
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:17,代码来源:EmpLoyeePortlet.java

示例3: setParameterIntoResponse

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
private void setParameterIntoResponse(ActionResponse response,
		Employee employee) throws PortalException, SystemException {
	response.setRenderParameter(EmployeeKeys.AddEditAttributes.MAPPINGUSERID,String.valueOf(employee.getMappingUserId()));
	response.setRenderParameter(EmployeeKeys.AddEditAttributes.WORKINGUNITID,String.valueOf(employee.getWorkingUnitId()));
	response.setRenderParameter(EmployeeKeys.AddEditAttributes.MAINJOBPOSID,String.valueOf(employee.getMainJobPosId()));
	response.setRenderParameter(EmployeeKeys.AddEditAttributes.EMPLOYEENO,String.valueOf(employee.getEmployeeNo()));
	response.setRenderParameter(EmployeeKeys.AddEditAttributes.PERSONELDOCNO,String.valueOf(employee.getPersonelDocNo()));
	response.setRenderParameter(EmployeeKeys.AddEditAttributes.FULLNAME,String.valueOf(employee.getFullName()));
	response.setRenderParameter(EmployeeKeys.AddEditAttributes.GENDER,String.valueOf(employee.getGender()));
	response.setRenderParameter(EmployeeKeys.AddEditAttributes.BIRTHDATE,String.valueOf(employee.getBirthdate()));
	response.setRenderParameter(EmployeeKeys.AddEditAttributes.OFFICETEL,String.valueOf(employee.getOfficeTel()));
	response.setRenderParameter(EmployeeKeys.AddEditAttributes.HOMETEL,String.valueOf(employee.getHomeTel()));
	response.setRenderParameter(EmployeeKeys.AddEditAttributes.MOBILE,String.valueOf(employee.getMobile()));
	response.setRenderParameter(EmployeeKeys.AddEditAttributes.EMAIL,String.valueOf(employee.getEmail()));
	if (employee.getMappingUserId() > 0){
		User user =  UserLocalServiceUtil.getUser(employee.getMappingUserId());
		response.setRenderParameter(EmployeeKeys.AddEditAttributes.SCREENNAME,String.valueOf(user.getScreenName()));
		//response.setRenderParameter(EmployeeKeys.AddEditAttributes.PASSWORD,String.valueOf(user.getPassword()));
		//response.setRenderParameter(EmployeeKeys.AddEditAttributes.REPASSWORD,String.valueOf(user.get()));
		response.setRenderParameter(EmployeeKeys.AddEditAttributes.ISCREATUSER,String.valueOf(1));
	}else {
		response.setRenderParameter(EmployeeKeys.AddEditAttributes.ISCREATUSER,String.valueOf(0));
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:25,代码来源:EmpLoyeePortlet.java

示例4: getApps

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
private int getApps(E_Stati status, Date time, StringBuffer buffer) throws SystemException {
	int result = 0;
	List<Application> apps = ApplicationLocalServiceUtil.getApplicationsAfter(status.getIntStatus(), time);
	if (apps != null && apps.size() > 0) {
		StringBuffer appStr = new StringBuffer();
		for (Application app: apps) {
			String name = app.getName();
			Date modified = app.getModifiedDate();
			SimpleDateFormat sdf = new SimpleDateFormat("dd.MM. HH:mm");
			String modStr = sdf.format(modified);
			String mail = null;
			try {
				mail = UserLocalServiceUtil.getUser(app.getUserId()).getEmailAddress();	
			} catch (Throwable t) {
				mail = "N/A";
			}
			appStr.append("\t Name: ").append(name).append(", Zeit: ").append(modStr).append(", Entwickler: ").append(mail).append("\n");
		}
		buffer.append(appStr);
		result = apps.size();
	}
	return result;
}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:24,代码来源:AppScheduler.java

示例5: saveDeregister

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
public void saveDeregister(ActionRequest request,
		ActionResponse response) throws IOException,
		PortletException {
	
	try{
		ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
		User user = themeDisplay.getUser();
		boolean deregisterMail = ParamUtil.getBoolean(request, "deregister", false);
		
		if(user.getExpandoBridge().getAttribute(LiferaylmsUtil.DEREGISTER_USER_EXPANDO)==null){
			user.getExpandoBridge().addAttribute(LiferaylmsUtil.DEREGISTER_USER_EXPANDO, ExpandoColumnConstants.BOOLEAN);
		}
		user.getExpandoBridge().setAttribute(LiferaylmsUtil.DEREGISTER_USER_EXPANDO, deregisterMail);
		
		UserLocalServiceUtil.updateUser(user);
		log.debug("User updated!");
		SessionMessages.add(request, "saveDeregisterOK");
		
	}catch(Exception e){
		e.printStackTrace();
		SessionErrors.add(request, "saveDeregisterKO");
	}
		
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:25,代码来源:DeregisterAcademyMailPortlet.java

示例6: createDefaultSiteTemplate

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
public void createDefaultSiteTemplate(long companyId) throws PortalException, SystemException 
{
	boolean exists = false;
	long layoutSetPrototypeId = 0;
	for(LayoutSetPrototype lay:LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototypes(0, LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototypesCount())){
		if(lay.getCompanyId() == companyId && "course".equals(lay.getName(LocaleUtil.getDefault()))) {
			exists=true;
			layoutSetPrototypeId = lay.getLayoutSetPrototypeId();
		}
	}
	
	if(!exists){
		long defaultUserId = UserLocalServiceUtil.getDefaultUserId(companyId);
		Map<Locale, String> nameMap = new HashMap<Locale, String>();
		nameMap.put(LocaleUtil.getDefault(), "course");
		layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.addLayoutSetPrototype(defaultUserId, companyId, nameMap, "course", true,true,new ServiceContext());
		InputStream larStream=this.getClass().getClassLoader().getResourceAsStream("/course.lar");
		LayoutLocalServiceUtil.importLayouts(defaultUserId,layoutSetPrototype.getGroup().getGroupId() , 
				layoutSetPrototype.getLayoutSet().isPrivateLayout(), getLayoutSetPrototypeParameters(), larStream);
	} else {
		layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(layoutSetPrototypeId);
	}
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:25,代码来源:StartupAction.java

示例7: getResult

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
public String getResult(long groupId){
	String result ="";
	try {
		Course curso = CourseLocalServiceUtil.getCourseByGroupCreatedId(groupId);
		User user = UserLocalServiceUtil.fetchUser(this.getUserId());
		Locale locale = user.getLocale();
		if(curso != null){
			CalificationType ct = new CalificationTypeRegistry().getCalificationType(curso.getCalificationType());
			result = ct.translate(locale,groupId, this.getResult());
		}
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return result;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:17,代码来源:LearningActivityResultImpl.java

示例8: getResult

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
public String getResult(long groupId){
	String result ="";
	try {
		Course curso = CourseLocalServiceUtil.getCourseByGroupCreatedId(groupId);
		User user = UserLocalServiceUtil.fetchUser(this.getUserId());
		Locale locale = user.getLocale();
		if(curso != null){
			CalificationType ct = new CalificationTypeRegistry().getCalificationType(curso.getCalificationType());
			result = ct.translate(locale, curso.getGroupCreatedId(),this.getResult());
		}
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return result;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:17,代码来源:LearningActivityTryImpl.java

示例9: getUsersByLearningActivity

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<User> getUsersByLearningActivity(long actId) throws SystemException, PortalException
{ 			
	List<User> users = new ArrayList<User>();
	
	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
	DynamicQuery consulta = DynamicQueryFactoryUtil.forClass(LearningActivityTry.class, classLoader)
				.add(PropertyFactoryUtil.forName("actId").eq(new Long(actId)));
				
	List<LearningActivityTry> activities = (List<LearningActivityTry>)learningActivityTryPersistence.findWithDynamicQuery(consulta);

	for(LearningActivityTry activity:activities){
		Long uId = activity.getUserId();
		User u = UserLocalServiceUtil.getUserById(uId.longValue());
		if(u!=null && !users.contains(u))
			users.add(u);
	}
	return users;		
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:20,代码来源:LearningActivityTryLocalServiceImpl.java

示例10: addTeacherToCourse

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
@JSONWebService
public void addTeacherToCourse(long courseId,String login) throws PortalException, SystemException
{ 
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	Course course=courseLocalService.getCourse(courseId);
	if(getPermissionChecker().hasPermission(course.getGroupId(),  Course.class.getName(),courseId,"ASSIGN_MEMBERS")&& ! course.isClosed())
	{
	
		User user = UserLocalServiceUtil.getUserByScreenName(serviceContext.getCompanyId(), login);
		if (!GroupLocalServiceUtil.hasUserGroup(user.getUserId(), course.getGroupCreatedId())) {
			GroupLocalServiceUtil.addUserGroups(user.getUserId(), new long[] { course.getGroupCreatedId() });
			//sendEmail(user,course);
		}
		UserGroupRoleLocalServiceUtil.addUserGroupRoles(new long[] { user.getUserId() },
				course.getGroupCreatedId(), LmsPrefsLocalServiceUtil.getLmsPrefs(serviceContext.getCompanyId()).getTeacherRole());

		//auditing
		AuditingLogFactory.audit(course.getCompanyId(), course.getGroupId(), Course.class.getName(), course.getCourseId(), serviceContext.getUserId(), AuditConstants.REGISTER, null);
		
	
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:23,代码来源:CourseServiceImpl.java

示例11: addEditorToCourse

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
@JSONWebService
public void addEditorToCourse(long courseId,String login) throws PortalException, SystemException
{
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	Course course=courseLocalService.getCourse(courseId);
	if(getPermissionChecker().hasPermission(course.getGroupId(),  Course.class.getName(),courseId,"ASSIGN_MEMBERS")&& ! course.isClosed())
	{
	
		User user = UserLocalServiceUtil.getUserByScreenName(serviceContext.getCompanyId(), login);
		if (!GroupLocalServiceUtil.hasUserGroup(user.getUserId(), course.getGroupCreatedId())) {
			GroupLocalServiceUtil.addUserGroups(user.getUserId(), new long[] { course.getGroupCreatedId() });
			//sendEmail(user,course);
		}
		UserGroupRoleLocalServiceUtil.addUserGroupRoles(new long[] { user.getUserId() },
				course.getGroupCreatedId(), LmsPrefsLocalServiceUtil.getLmsPrefs(serviceContext.getCompanyId()).getEditorRole());

		//auditing
		AuditingLogFactory.audit(course.getCompanyId(), course.getGroupId(), Course.class.getName(), course.getCourseId(), serviceContext.getUserId(), AuditConstants.REGISTER, null);
	
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:22,代码来源:CourseServiceImpl.java

示例12: removeStudentFromCourse

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
@JSONWebService
public void removeStudentFromCourse(long courseId,String login) throws PrincipalException, PortalException, SystemException
{
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	Course course=courseLocalService.getCourse(courseId);
	if(getPermissionChecker().hasPermission(course.getGroupId(),  Course.class.getName(),courseId,"ASSIGN_MEMBERS")&& ! course.isClosed())
	{
	
		User user = UserLocalServiceUtil.getUserByScreenName(serviceContext.getCompanyId(), login);
		GroupLocalServiceUtil.unsetUserGroups(user.getUserId(),new long[] { course.getGroupCreatedId() });

		//auditing
		AuditingLogFactory.audit(course.getCompanyId(), course.getGroupId(), Course.class.getName(), course.getCourseId(), serviceContext.getUserId(), AuditConstants.UNREGISTER, null);
		
	
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:18,代码来源:CourseServiceImpl.java

示例13: removeTeacherFromCourse

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
@JSONWebService
public void removeTeacherFromCourse(long courseId,String login) throws PortalException, SystemException
{
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	Course course=courseLocalService.getCourse(courseId);
	if(getPermissionChecker().hasPermission(course.getGroupId(),  Course.class.getName(),courseId,"ASSIGN_MEMBERS")&& ! course.isClosed())
	{
	
		User user = UserLocalServiceUtil.getUserByScreenName(serviceContext.getCompanyId(), login);
		UserGroupRoleLocalServiceUtil.deleteUserGroupRoles(new long[] { user.getUserId() },
				course.getGroupCreatedId(), LmsPrefsLocalServiceUtil.getLmsPrefs(serviceContext.getCompanyId()).getTeacherRole());

		//auditing
		AuditingLogFactory.audit(course.getCompanyId(), course.getGroupId(), Course.class.getName(), course.getCourseId(), serviceContext.getUserId(), AuditConstants.UNREGISTER, null);
		
	
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:19,代码来源:CourseServiceImpl.java

示例14: removeEditorFromCourse

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
@JSONWebService
public void removeEditorFromCourse(long courseId,String login) throws PortalException, SystemException
{
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	Course course=courseLocalService.getCourse(courseId);
	if(getPermissionChecker().hasPermission(course.getGroupId(),  Course.class.getName(),courseId,"ASSIGN_MEMBERS")&& ! course.isClosed())
	{
	
		User user = UserLocalServiceUtil.getUserByScreenName(serviceContext.getCompanyId(), login);
		UserGroupRoleLocalServiceUtil.deleteUserGroupRoles(new long[] { user.getUserId() },
				course.getGroupCreatedId(), LmsPrefsLocalServiceUtil.getLmsPrefs(serviceContext.getCompanyId()).getEditorRole());

		//auditing
		AuditingLogFactory.audit(course.getCompanyId(), course.getGroupId(), Course.class.getName(), course.getCourseId(), serviceContext.getUserId(), AuditConstants.UNREGISTER, null);
		
	
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:19,代码来源:CourseServiceImpl.java

示例15: updateUser

import com.liferay.portal.service.UserLocalServiceUtil; //导入依赖的package包/类
@JSONWebService
public void updateUser(String login, String firstName,String lastName,String email) throws PortalException, SystemException
{
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	
		User user = UserLocalServiceUtil.getUserByScreenName(
				serviceContext.getCompanyId(), login);
		user.setFirstName(firstName);
		user.setLastName(lastName);
		user.setEmailAddress(email);
		List<UserGroup> userGroups = user.getUserGroups();
		long[] userArray = new long[] { user.getUserId() };
		if(PortalPermissionUtil.contains(
				getPermissionChecker(), ActionKeys.ADD_USER))
		{
			UserLocalServiceUtil.updateUser(user);
		}

}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:20,代码来源:CourseServiceImpl.java


注:本文中的com.liferay.portal.service.UserLocalServiceUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。