• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ServiceContextThreadLocal类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addEbPartnerShip

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
public void addEbPartnerShip(ActionRequest actionRequest,
		ActionResponse actionResponse) throws PortletException {
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	try {
		String name = ParamUtil.getString(actionRequest, "name");
		String cpaId = ParamUtil.getString(actionRequest, "cpaId");
		String service = ParamUtil.getString(actionRequest, "service");
		
		EbPartnerShip ebPartnerShip = EbPartnerShipLocalServiceUtil.addEbPartnerShip(name, cpaId, service, serviceContext);
		
		/*
		actionResponse.setRenderParameter("ebPartnerShipId", String.valueOf(ebPartnerShip.getEbPartnerShipId()));
		actionResponse.setRenderParameter("mvcPath",
				"/html/dossiermgt/portlet/ebpartnership/edit_ebpartnership.jsp");
		*/
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:20,代码来源:EbPartnerShipPortlet.java


示例2: updateEbPartnerShip

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
public void updateEbPartnerShip(ActionRequest actionRequest,
		ActionResponse actionResponse) throws PortletException {
	try {
		ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
		long ebPartnerShipId = ParamUtil.getLong(actionRequest, "ebPartnerShipId");
		
		String name = ParamUtil.getString(actionRequest, "name");
		String cpaId = ParamUtil.getString(actionRequest, "cpaId");
		String service = ParamUtil.getString(actionRequest, "service");

		EbPartnerShip ebPartnerShip = EbPartnerShipLocalServiceUtil.getEbPartnerShip(ebPartnerShipId);
		if (ebPartnerShip != null) {
			ebPartnerShip = EbPartnerShipLocalServiceUtil.updateEbPartnerShip(ebPartnerShipId, name, cpaId, service, serviceContext);										
		} else {
			_log.error("Could not find eb partner ship.");
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:21,代码来源:EbPartnerShipPortlet.java


示例3: addDocTemplate

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
public void addDocTemplate(ActionRequest actionRequest,
		ActionResponse actionResponse) throws PortletException {
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	try {
		String templateNo = ParamUtil.getString(actionRequest, "templateNo");
		String title = ParamUtil.getString(actionRequest, "title");
		String enTitle = ParamUtil.getString(actionRequest, "enTitle");
		String _uuid = ParamUtil.getString(actionRequest, "fileEntryUuid");
		DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.getFileEntryByUuidAndGroupId(_uuid, serviceContext.getScopeGroupId());
		DocTemplate docTemplate = DocTemplateLocalServiceUtil.addDocTemplate(templateNo, title, enTitle, fileEntry.getFileEntryId(), serviceContext);
		
		if (docTemplate != null) {
			SessionMessages.add(actionRequest.getPortletSession(), DocTemplateKeys.SuccessMessageKeys.ORG_OEP_CORE_UTILITIES_DOSSIERMGT_PORTLET_DOCTEMPLATE_SUCCESS_ADDNEW);
			_log.info("doc template have been added successfylly");
		} else {
			_log.error("There is an Erron in adding doc template");
		}
		actionResponse.setRenderParameter("mvcPath",
				"/html/dossiermgt/portlet/doctemplate/edit_doctemplate.jsp");
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:24,代码来源:DocTemplatePortlet.java


示例4: addDossierProcess

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
public void addDossierProcess(ActionRequest actionRequest,
		ActionResponse actionResponse) throws PortletException {
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	try {
		long dossierProcId = ParamUtil.getLong(actionRequest, "dossierProcId");
		String govAgencyId = ParamUtil.getString(actionRequest, "govAgencyId");
		String govAgencyName = ParamUtil.getString(actionRequest, "govAgencyName");
		long startStepTransitionId = 0;
		int daysDuration = ParamUtil.getInteger(actionRequest, "daysDuration");
		int fee = ParamUtil.getInteger(actionRequest, "fee");
		
		DossierProcess dossierProcess = DossierProcessLocalServiceUtil.addDossierProcess(dossierProcId, govAgencyId, govAgencyName, startStepTransitionId, daysDuration, fee, serviceContext);
		
		actionResponse.setRenderParameter("mvcPath",
				"/html/processmgt/portlet/dossierprocess/edit_dossierprocess.jsp");
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:20,代码来源:DossierProcessPortlet.java


示例5: updateDossierProcess

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
public void updateDossierProcess(ActionRequest actionRequest,
		ActionResponse actionResponse) throws PortletException {
	try {
		ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
		long dossierProcessId = ParamUtil.getLong(actionRequest, "dossierProcessId");
		long dossierProcId = ParamUtil.getLong(actionRequest, "dossierProcId");
		String govAgencyId = ParamUtil.getString(actionRequest, "govAgencyId");
		String govAgencyName = ParamUtil.getString(actionRequest, "govAgencyName");
		long startStepTransitionId = 0;
		int daysDuration = ParamUtil.getInteger(actionRequest, "daysDuration");
		int fee = ParamUtil.getInteger(actionRequest, "fee");
		DossierProcess dossierProcess = DossierProcessLocalServiceUtil.getDossierProcess(dossierProcessId);
		dossierProcess = DossierProcessLocalServiceUtil.updateDossierProcess(dossierProcessId, dossierProcId, govAgencyId, govAgencyName, startStepTransitionId, daysDuration, fee, serviceContext);					
		actionResponse.setRenderParameter("mvcPath",
				"/html/processmgt/portlet/dossierprocess/list_dossierprocess.jsp");
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:20,代码来源:DossierProcessPortlet.java


示例6: addEditAppRole2JobPos

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
public void addEditAppRole2JobPos(ActionRequest request, ActionResponse response) throws SystemException, PortalException, IOException {
	if (SessionErrors.isEmpty(request)) {
		ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
		long appRoleId = ParamUtil.getLong(request, AppRole2JobPosKeys.AddEditAttributes.APPROLE_ID, PortletKeys.LONG_DEFAULT);
		long jobPosId = ParamUtil.getLong(request, AppRole2JobPosKeys.AddEditAttributes.JOBPOS_ID, PortletKeys.LONG_DEFAULT);
		
		Long editId = ParamUtil.getLong(request, AppRole2JobPosKeys.AddEditAttributes.EDIT_ID, PortletKeys.LONG_DEFAULT);
		if (editId == PortletKeys.LONG_DEFAULT) {
			AppRole2JobPosLocalServiceUtil.addAppRole2JobPos(appRoleId, jobPosId, serviceContext);
			SessionMessages.add(request, AssignRoleKeys.SuccessMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_ASSIGNROLE2JOBPOS_SUCCESS_ADDNEW);	
		} else {
		}
	}
	SessionMessages.add(request, PortalUtil.getPortletId(request) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE); 		
	if (!SessionErrors.isEmpty(request)) {
		PortalUtil.copyRequestParameters(request, response);
	} else {
		response.sendRedirect(ParamUtil.getString(request, PortletKeys.REDIRECT_PAGE));
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:21,代码来源:AppRolePortlet.java


示例7: addEditAppRole

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
public void addEditAppRole(ActionRequest request, ActionResponse response) throws SystemException, PortalException, IOException {
	validateParamsIntoSessionError(request);
	
	if (SessionErrors.isEmpty(request)) {
		ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
		long applicationId = ParamUtil.getLong(request, AppRoleKeys.AddEditAttributes.APPLICATION_ID, PortletKeys.LONG_DEFAULT);
		String roleCode = ParamUtil.getString(request, AppRoleKeys.AddEditAttributes.ROLE_CODE, PortletKeys.TEXT_BOX);
		String roleName = ParamUtil.getString(request, AppRoleKeys.AddEditAttributes.ROLE_NAME, PortletKeys.TEXT_BOX);
		
		Long editId = ParamUtil.getLong(request, AppRoleKeys.AddEditAttributes.EDIT_ID, PortletKeys.LONG_DEFAULT);
		if (editId == PortletKeys.LONG_DEFAULT) {
			AppRoleLocalServiceUtil.addAppRole(applicationId, roleCode, roleName, serviceContext);
			SessionMessages.add(request, AppRoleKeys.SuccessMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_SUCCESS_ADDNEW);	
		} else {
			AppRoleLocalServiceUtil.updateAppRole(editId, applicationId, roleCode, roleName, serviceContext);
			SessionMessages.add(request, AppRoleKeys.SuccessMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_SUCCESS_UPDATE);	
		}
	}
	SessionMessages.add(request, PortalUtil.getPortletId(request) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE); 		
	if (!SessionErrors.isEmpty(request)) {
		PortalUtil.copyRequestParameters(request, response);
	} else {
		response.sendRedirect(ParamUtil.getString(request, PortletKeys.REDIRECT_PAGE));
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:26,代码来源:AppRolePortlet.java


示例8: delete

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的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


示例9: addEditAppRole

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
public void addEditAppRole(ActionRequest request, ActionResponse response) throws SystemException, PortalException, IOException {
	
	if (SessionErrors.isEmpty(request)) {
		ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
		long applicationId = ParamUtil.getLong(request, AppRoleKeys.AddEditAttributes.APPLICATION_ID, PortletKeys.LONG_DEFAULT);
		String roleCode = ParamUtil.getString(request, AppRoleKeys.AddEditAttributes.ROLE_CODE, PortletKeys.TEXT_BOX);
		String roleName = ParamUtil.getString(request, AppRoleKeys.AddEditAttributes.ROLE_NAME, PortletKeys.TEXT_BOX);
		
		Long editId = ParamUtil.getLong(request, AppRoleKeys.AddEditAttributes.EDIT_ID, PortletKeys.LONG_DEFAULT);
		if (editId == PortletKeys.LONG_DEFAULT) {
			AppRoleLocalServiceUtil.addAppRole(applicationId, roleCode, roleName, serviceContext);
		} else {
			AppRoleLocalServiceUtil.updateAppRole(editId, applicationId, roleCode, roleName, serviceContext);
		}
	}
	if (!SessionErrors.isEmpty(request)) {
		PortalUtil.copyRequestParameters(request, response);
	} else {
		response.sendRedirect(ParamUtil.getString(request, PortletKeys.REDIRECT_PAGE));
	}
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:22,代码来源:AppRolePortlet.java


示例10: update

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
public LearningActivityResult update(long latId, long result, String tryResultData) throws PortalException, SystemException
{
	User user=this.getUser();
	LearningActivityResult lar = learningActivityResultLocalService.update(latId, result, tryResultData, user.getUserId());
	
	//auditing
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	if(serviceContext!=null){
		AuditingLogFactory.audit(serviceContext.getCompanyId(), serviceContext.getScopeGroupId(), LearningActivityResult.class.getName(), 
			latId, serviceContext.getUserId(), AuditConstants.UPDATE, null);
	}else{
		if(lar!=null){
			LearningActivity la = learningActivityPersistence.fetchByPrimaryKey(lar.getActId());
			if(la!=null){
				AuditingLogFactory.audit(serviceContext.getCompanyId(), serviceContext.getScopeGroupId(), LearningActivityResult.class.getName(), 
						latId, serviceContext.getUserId(), AuditConstants.UPDATE, null);
			}
		}
	}
	
	return lar;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:23,代码来源:LearningActivityResultServiceImpl.java


示例11: createCourse

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
@JSONWebService
public Course createCourse(long groupId,String title, String description,boolean published,String summary,int evaluationmethod,int calificationType,int template,int registermethod,int maxusers, Date startregistrationdate,Date endregistrationdate) throws PortalException, SystemException
{
	User user=getUser();
	
	java.util.Date ahora=new java.util.Date(System.currentTimeMillis());
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	serviceContext.setUserId(user.getUserId());
	serviceContext.setScopeGroupId(groupId);
	String groupName = GroupConstants.GUEST;
	long companyId = PortalUtil.getDefaultCompanyId();
	
	if( getPermissionChecker().hasPermission(groupId, "com.liferay.lms.coursemodel",groupId,"ADD_COURSE"))
	{
		Course course = com.liferay.lms.service.CourseLocalServiceUtil.addCourse(
				title, description, summary, StringPool.BLANK,
				user.getLocale(), ahora, startregistrationdate, endregistrationdate,template,registermethod,evaluationmethod,
				calificationType,maxusers,serviceContext,false);
		com.liferay.lms.service.CourseLocalServiceUtil.setVisible(course.getCourseId(), published);
		return course;
	}
	else
	{
		return null;
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:27,代码来源:CourseServiceImpl.java


示例12: getCourseTeachers

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
@JSONWebService
public java.util.List<String> getCourseTeachers(long courseId) throws PortalException, SystemException
{
	User user=getUser();
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	Course course=courseLocalService.getCourse(courseId);
	long createdGroupId=course.getGroupCreatedId();
	if(course.getCompanyId()==user.getCompanyId())
	{
		LmsPrefs prefs=LmsPrefsLocalServiceUtil.getLmsPrefs(course.getCompanyId());
		List<UserGroupRole> ugrs=UserGroupRoleLocalServiceUtil.getUserGroupRolesByGroupAndRole(createdGroupId, prefs.getTeacherRole());
		List<String> users=new java.util.ArrayList<String>();
		for(UserGroupRole ugr:ugrs)
		{
			users.add(ugr.getUser().getScreenName());
		}
		return users;
	}
	return null;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:21,代码来源:CourseServiceImpl.java


示例13: getCourseEditors

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
@JSONWebService
public java.util.List<String> getCourseEditors(long courseId) throws PortalException, SystemException
{
	User user=getUser();
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	Course course=courseLocalService.getCourse(courseId);
	long createdGroupId=course.getGroupCreatedId();
	if(course.getCompanyId()==user.getCompanyId())
	{
		LmsPrefs prefs=LmsPrefsLocalServiceUtil.getLmsPrefs(course.getCompanyId());
		List<UserGroupRole> ugrs=UserGroupRoleLocalServiceUtil.getUserGroupRolesByGroupAndRole(createdGroupId, prefs.getEditorRole());
		List<String> users=new java.util.ArrayList<String>();
		for(UserGroupRole ugr:ugrs)
		{
			users.add(ugr.getUser().getScreenName());
		}
		return users;
	}
	return null;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:21,代码来源:CourseServiceImpl.java


示例14: addStudentToCourse

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
@JSONWebService
public void addStudentToCourse(long courseId,String login) throws PortalException, SystemException
{
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	Course course=courseLocalService.fetchCourse(courseId);
	User user = userLocalService.fetchUserByScreenName(serviceContext.getCompanyId(), login);
	if(course!=null && user!=null){
		if(getPermissionChecker().hasPermission(course.getGroupId(),  Course.class.getName(),courseId,"ASSIGN_MEMBERS")&& ! course.isClosed())
		{
			
			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(), RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(), RoleConstants.SITE_MEMBER).getRoleId());

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


示例15: editUserInscriptionDates

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的package包/类
public void editUserInscriptionDates(long courseId,long userId,Date allowStartDate,Date allowFinishDate) 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 = userLocalService.getUser(userId);
		if (!GroupLocalServiceUtil.hasUserGroup(user.getUserId(), course.getGroupCreatedId())) {
			return;
		}		
		CourseResult courseResult=courseResultLocalService.getCourseResultByCourseAndUser(courseId, user.getUserId());
		if(courseResult==null)
		{
			courseResultLocalService.create(courseId, user.getUserId(), allowStartDate, allowFinishDate);
		}
		else
		{
			courseResult.setAllowStartDate(allowStartDate);
			courseResult.setAllowFinishDate(allowFinishDate);
			courseResultLocalService.updateCourseResult(courseResult);
		}
		//auditing
		AuditingLogFactory.audit(course.getCompanyId(), course.getGroupId(), Course.class.getName(), course.getCourseId(), serviceContext.getUserId(), AuditConstants.UPDATE, null);		 
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:26,代码来源:CourseServiceImpl.java


示例16: addTeacherToCourse

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的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


示例17: addEditorToCourse

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的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


示例18: removeStudentFromCourse

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的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


示例19: removeTeacherFromCourse

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的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


示例20: removeEditorFromCourse

import com.liferay.portal.service.ServiceContextThreadLocal; //导入依赖的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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OnErrorListener类代码示例发布时间:2022-05-22
下一篇:
Java OpenEditorActionGroup类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap