public void serveResource(ResourceRequest request, ResourceResponse response)throws PortletException, IOException {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
String action = ParamUtil.getString(request, "action");
if(action.equals("getCourses")){
JSONArray usersJSONArray = JSONFactoryUtil.createJSONArray();
String freeText = ParamUtil.getString(request, "courseTitle");
List<Course> listCourse = CourseLocalServiceUtil.getCoursesCatalogByTitleCategoriesTags(freeText, null, null, themeDisplay.getCompanyId(),
themeDisplay.getScopeGroupId(), themeDisplay.getUserId(), themeDisplay.getLanguageId(), -1, -1);
JSONObject userJSON = null;
for (Course course : listCourse) {
userJSON = JSONFactoryUtil.createJSONObject();
userJSON.put("courseTitle", course.getTitle(themeDisplay.getLocale()));
userJSON.put("courseDescription", course.getDescription(themeDisplay.getLocale()));
usersJSONArray.put(userJSON);
}
PrintWriter out = response.getWriter();
out.println(usersJSONArray.toString());
}
}
CatalogCourses.java 文件源码
java
阅读 17
收藏 0
点赞 0
评论 0
项目:liferaylms-portlet
作者:
评论列表
文章目录