本文整理汇总了Java中com.liferay.portal.kernel.jsonwebservice.JSONWebService类的典型用法代码示例。如果您正苦于以下问题:Java JSONWebService类的具体用法?Java JSONWebService怎么用?Java JSONWebService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JSONWebService类属于com.liferay.portal.kernel.jsonwebservice包,在下文中一共展示了JSONWebService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ping
import com.liferay.portal.kernel.jsonwebservice.JSONWebService; //导入依赖的package包/类
@JSONWebService(value="ping")
@AccessControlled(guestAccessEnabled=true)
public String ping(String app, String pin) throws SystemException {
JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
Application checkApp = null;
try {
checkApp = ApplicationLocalServiceUtil.getByAppCode(app);
} catch (NoSuchApplicationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
jsonObj.put("success", false);
jsonObj.put("errorCode", 1);
return jsonObj.toString();
}
if (checkApp != null) {
if (!checkApp.getAppPin().equals(pin)) {
jsonObj.put("success", false);
jsonObj.put("errorCode", 2);
return jsonObj.toString();
}
}
Application application = ApplicationLocalServiceUtil.ping(app, pin);
if (application == null) {
jsonObj.put("success", false);
jsonObj.put("errorCode", 3);
}
else {
jsonObj.put("success", true);
}
return jsonObj.toString();
}
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:34,代码来源:SSOAppServiceImpl.java
示例17: getLearningActivity
import com.liferay.portal.kernel.jsonwebservice.JSONWebService; //导入依赖的package包/类
@JSONWebService
public LearningActivity getLearningActivity(long actId) throws PortalException, SystemException
{
LearningActivity lernact=learningActivityLocalService.getLearningActivity(actId);
if( getPermissionChecker().hasPermission(lernact.getGroupId(), LearningActivity.class.getName(), lernact.getActId(),
ActionKeys.VIEW))
{
return lernact;
}
else
{
return null;
}
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:16,代码来源:LearningActivityServiceImpl.java
示例18: getCourses
import com.liferay.portal.kernel.jsonwebservice.JSONWebService; //导入依赖的package包/类
@JSONWebService
public java.util.List<Course> getCourses() throws SystemException, PortalException
{
String groupName = GroupConstants.GUEST;
long companyId = PortalUtil.getDefaultCompanyId();
long guestGroupId = GroupLocalServiceUtil.getGroup(companyId, groupName).getGroupId();
return coursePersistence.filterFindByGroupId(guestGroupId);
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:11,代码来源:CourseServiceImpl.java
示例19: getCourseStudents
import com.liferay.portal.kernel.jsonwebservice.JSONWebService; //导入依赖的package包/类
@JSONWebService
public java.util.List<String> getCourseStudents(long courseId) throws PortalException, SystemException
{
User user=getUser();
ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
Course course=courseLocalService.getCourse(courseId);
if(course.getCompanyId()==user.getCompanyId())
{
LmsPrefs prefs=LmsPrefsLocalServiceUtil.getLmsPrefs(course.getCompanyId());
Role commmanager=RoleLocalServiceUtil.getRole(course.getCompanyId(), RoleConstants.SITE_MEMBER) ;
java.util.List<String> users=new java.util.ArrayList<String>();
long createdGroupId=course.getGroupCreatedId();
java.util.List<User> userst=UserLocalServiceUtil.getGroupUsers(createdGroupId);
for(User usert:userst)
{
List<UserGroupRole> userGroupRoles = UserGroupRoleLocalServiceUtil.getUserGroupRoles(usert.getUserId(),createdGroupId);
boolean remove =false;
for(UserGroupRole ugr:userGroupRoles){
if(ugr.getRoleId()==prefs.getEditorRole()||ugr.getRoleId()==prefs.getTeacherRole()){
remove = true;
break;
}
}
if(!remove){
users.add(usert.getScreenName());
}
}
return users;
}
return null;
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:35,代码来源:CourseServiceImpl.java
示例20: addStudentToCourseWithDates
import com.liferay.portal.kernel.jsonwebservice.JSONWebService; //导入依赖的package包/类
@JSONWebService
public void addStudentToCourseWithDates(long courseId,String login,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.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(), RoleLocalServiceUtil.getRole(serviceContext.getCompanyId(), RoleConstants.SITE_MEMBER).getRoleId());
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.REGISTER, null);
}
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:31,代码来源:CourseServiceImpl.java
注:本文中的com.liferay.portal.kernel.jsonwebservice.JSONWebService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论