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


Java JSONWebService类代码示例

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


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

示例1: createCourse

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

示例2: getCourseTeachers

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

示例3: getCourseEditors

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

示例4: addStudentToCourse

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

示例5: addTeacherToCourse

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

示例6: addEditorToCourse

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

示例7: removeStudentFromCourse

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

示例8: removeTeacherFromCourse

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

示例9: removeEditorFromCourse

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

示例10: myCourses

import com.liferay.portal.kernel.jsonwebservice.JSONWebService; //导入依赖的package包/类
@JSONWebService
public java.util.List<Course> myCourses() throws PortalException, SystemException
{
	User usuario= this.getUser();
	java.util.List<Group> groups= GroupLocalServiceUtil.getUserGroups(usuario.getUserId());
	java.util.List<Course> results=new java.util.ArrayList<Course>();
	
	for(Group groupCourse:groups)
	{
		
		
		Course course=courseLocalService.fetchByGroupCreatedId(groupCourse.getGroupId());
		if(course!=null)
		{
			results.add(course);
		}
	}
	return results;

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

示例11: updateUser

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

示例12: getStudentsFromCourseCount

import com.liferay.portal.kernel.jsonwebservice.JSONWebService; //导入依赖的package包/类
@JSONWebService
public int getStudentsFromCourseCount(long courseId){
	int students = 0;
	try{
		
		Course course = courseLocalService.fetchCourse(courseId);
		if (getPermissionChecker() == null
				|| course == null
				|| !(getPermissionChecker().hasPermission(course.getGroupId(), Course.class.getName(),
						course.getCourseId(), "VIEW") || getPermissionChecker()
						.hasOwnerPermission(course.getCompanyId(), Course.class.getName(), course.getCourseId(),
								course.getUserId(), "VIEW"))) {
			return students;
		}
		
		students=courseLocalService.getStudentsFromCourseCount(courseId);
	}catch(Exception e){
		e.printStackTrace();
	}
	return students;
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:23,代码来源:CourseServiceImpl.java

示例13: findAllInGroup

import com.liferay.portal.kernel.jsonwebservice.JSONWebService; //导入依赖的package包/类
@JSONWebService
public List<Module> findAllInGroup(long groupId) throws SystemException, PortalException {
	List<Module> modules; 
	Course course = CourseLocalServiceUtil.fetchByGroupCreatedId(groupId);
	if (getPermissionChecker() == null
			|| course == null
			|| !(getPermissionChecker().hasPermission(course.getGroupId(), Course.class.getName(),
					course.getCourseId(), "VIEW") || getPermissionChecker()
					.hasOwnerPermission(course.getCompanyId(), Course.class.getName(), course.getCourseId(),
							course.getUserId(), "VIEW"))) {
		modules = new ArrayList<Module>();
	}else{
		modules= (List<Module>) modulePersistence.filterFindByGroupId(groupId);
	}		
	return modules;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:17,代码来源:ModuleServiceImpl.java

示例14: isUserPassed

import com.liferay.portal.kernel.jsonwebservice.JSONWebService; //导入依赖的package包/类
@JSONWebService
public boolean isUserPassed(long moduleId,String login) throws SystemException, PortalException
{
	User usuario= this.getUser();
	Module module=moduleLocalService.getModule(moduleId);
	Course course=courseLocalService.getCourseByGroupCreatedId(module.getGroupId());
	if(getPermissionChecker().hasPermission(course.getGroupId(),  Course.class.getName(),course.getCourseId(),"ASSIGN_MEMBERS"))
	{
		ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
		User user = UserLocalServiceUtil.getUserByScreenName(serviceContext.getCompanyId(), login);	
		return moduleLocalService.isUserPassed(moduleId, user.getUserId());
		
	}
	return false;

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

示例15: newMessage

import com.liferay.portal.kernel.jsonwebservice.JSONWebService; //导入依赖的package包/类
@com.liferay.portal.kernel.jsonwebservice.JSONWebService(value = "newMessage")
@com.liferay.portal.security.ac.AccessControlled(guestAccessEnabled = true)
public java.lang.String newMessage(java.lang.String appCode,
	java.lang.String appPin, java.util.Date createDate,
	java.lang.String toUser, java.lang.String messageType,
	java.lang.String messageCode, java.lang.String messageText,
	java.lang.String messageValue, java.lang.String messageUrl,
	java.lang.String signature)
	throws com.liferay.portal.kernel.exception.PortalException,
		com.liferay.portal.kernel.exception.SystemException;
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:11,代码来源:SSOAppService.java


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