/** * Saves the global aspect of the configuration * * @param request The request * @param response The response * @throws IOException If something goes wrong * @throws PortletException If something goes wrong */ @ProcessAction(name = ACTION_NAME_SAVE_GLOBAL) public void actionSaveGlobal(ActionRequest request, ActionResponse response) throws IOException, PortletException { String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK); String adtUuid = ParamUtil.get(request, FORM_FIELD_ADT_UUID, StringPool.BLANK); boolean doSearchOnStartup = ParamUtil.getBoolean(request, FORM_FIELD_DO_SEARCH_ON_STARTUP, false); if (!PATTERN_UUID.matcher(adtUuid).matches()) { adtUuid = StringPool.BLANK; } String doSearchOnStartupKeywords = ParamUtil.getString(request, FORM_FIELD_DO_SEARCH_ON_STARTUP_KEYWORDS, FlashlightSearchService.CONFIGURATION_DEFAULT_SEARCH_KEYWORDS); this.searchService.saveGlobalSettings(adtUuid, doSearchOnStartup, doSearchOnStartupKeywords, request.getPreferences()); SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED); if (!redirectUrl.isEmpty()) { response.sendRedirect(redirectUrl); } }
/** * This action saves the Liferay facet configuration for a given tab * * @param request The request * @param response The response * @throws PortletException If something goes wrong * @throws IOException If something goes wrong */ @ProcessAction(name = ACTION_NAME_SAVE_FACET_CONFIG) public void actionSaveFacetConfig(ActionRequest request, ActionResponse response) throws PortletException, IOException { String tabId = ParamUtil.get(request, PortletRequestParameter.TAB_ID.getName(), StringPool.BLANK); String facetClassName = ParamUtil.get(request, FORM_FIELD_FACET_CLASS_NAME, StringPool.BLANK); String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK); PortletPreferences preferences = request.getPreferences(); FlashlightSearchConfiguration configuration = this.searchService.readConfiguration(preferences); SearchFacet targetFacet = this.getSearchFacetFromRequest(tabId, facetClassName, configuration); if(targetFacet != null) { JSONObject facetConfiguration = targetFacet.getJSONData(request); targetFacet.getFacetConfiguration().setDataJSONObject(facetConfiguration); this.searchService.saveSearchFacetConfig(configuration.getTabs().get(tabId), targetFacet, preferences); SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED); response.sendRedirect(redirectUrl); } }
/** * Deletes a tab from the configuration * * @param request The request * @param response The response * @throws PortletException If something goes wrong * @throws IOException If something goes wrong */ @ProcessAction(name = ACTION_NAME_DELETE_TAB) public void actionDeleteTab(ActionRequest request, ActionResponse response) throws PortletException, IOException { String tabId = ParamUtil.get(request, PortletRequestParameter.TAB_ID.getName(), StringPool.BLANK); String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK); if (tabId != null && PATTERN_UUID.matcher(tabId).matches()) { PortletPreferences preferences = request.getPreferences(); Map<String, FlashlightSearchConfigurationTab> tabs = this.searchService.readConfiguration(preferences).getTabs(); if (tabs.containsKey(tabId)) { this.searchService.deleteConfigurationTab(tabId, preferences); } } SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED); if (!redirectUrl.isEmpty()) { response.sendRedirect(redirectUrl); } }
/** * Remove portlet from the page * * @param request The request * @param response The response */ @ProcessAction(name = "removePortlet") public void removePortletAction(ActionRequest request, ActionResponse response) throws IOException { Layout currentLayout = (Layout) request.getAttribute(WebKeys.LAYOUT); String portletId = ParamUtil.getString(request, RQ_PARAM_PORTLET_ID, null); if(portletId != null) { Matcher m = PATTERN_PORTLET_ID.matcher(portletId); if(m.matches()) { try { this.serviceRef.removePortlet(currentLayout, portletId); } catch(PortalException e) { LOG.error("Unable to remove portlet", e); } } } }
@ProcessAction(name="processEvent") public void processEvent(ActionRequest request, ActionResponse response) { /** * Get sample text from UI */ String sampleText = ParamUtil.getString(request, "sampleText",""); Employee employee = new Employee(); //employee.name = "Trung"; employee.name = sampleText; employee.address = "Dong Anh"; /** * Refer portlet.xml */ QName qName = new QName("http://proliferay.com/events", "ipc-text"); response.setEvent(qName, employee); }
/** * This Action gets a categoryId/regionId from the request and puts it as parentCategoryId/parentRegionId into the * request. It also sets the "jspPage" parameter to "contentViewJSP" so that * processing is forwarded to view.jsp. * * @param request * @param response * @throws PortalException * @throws java.lang.Exception */ @ProcessAction(name = "readViewDisplay") public void readCategoryDisplay(ActionRequest request, ActionResponse response) { String errorForward = "/devel/error.jsp"; try { errorForward = ParamUtil.getString(request, "errorForward"); String successForward = ParamUtil.getString(request, "successForward"); long categoryId = ParamUtil.getLong(request, "categoryId"); if (Validator.isNotNull(categoryId)) { request.setAttribute("categoryId", categoryId); } long regionId = ParamUtil.getLong(request, "regionId"); if (Validator.isNotNull(regionId)) { request.setAttribute("regionId", regionId); } response.setRenderParameter("jspPage", successForward); } catch (Exception e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", errorForward); } }
/** * This Action sets the "jspPage" parameter to "ActionRequest-param successForward" so that * processing is forwarded to ActionRequest-param successForward. * * @param request * @param response * ActionRequest-param exceptionForward * ActionRequest-param successForward * ActionRequest-param applicationId * @throws PortalException * @throws java.lang.Exception */ @ProcessAction(name = "applicationRedirectWId") public void applicationRedirectWId(ActionRequest request, ActionResponse response) { String exceptionForward = "/devel/error.jsp"; try { exceptionForward = ParamUtil.getString(request, "exceptionForward"); String successForward = ParamUtil.getString(request, "successForward"); Application application = ApplicationLocalServiceUtil.getApplication(ParamUtil.getLong(request, "applicationId")); if (Validator.isNotNull(application)) { request.setAttribute("application", application); response.setRenderParameter("jspPage", successForward); } else { request.setAttribute("errorMsg", "Internal Error: missing aplicationId"); response.setRenderParameter("jspPage", exceptionForward); } } catch (Exception e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", exceptionForward); } }
/** * This Action sets the "jspPage" parameter to the ActionRequest - parameter successForward so that * processing is forwarded to successForward. * * @param request * @param response * ActionRequest-param successForward * ActionRequest-param exceptionForward * ActionRequest-param applicationId * ActionResponse-param application * @throws PortalException * @throws java.lang.Exception */ @ProcessAction(name = "applicationActionCloneApplication") public void applicationActionCloneApplication(ActionRequest request, ActionResponse response) { String exceptionForward = "/devel/error.jsp"; try { exceptionForward = ParamUtil.getString(request, "exceptionForward"); String successForward = ParamUtil.getString(request, "successForward"); _log.debug("applicationRedirectActionWithId: " + ParamUtil.getLong(request, "applicationId")); if (Validator.isNotNull(ParamUtil.getLong(request, "applicationId")) && ParamUtil.getLong(request, "applicationId") != 0) { Application application = ApplicationLocalServiceUtil.clone(ParamUtil.getLong(request, "applicationId")); request.setAttribute("application", application); response.setRenderParameter("jspPage", successForward); } response.setRenderParameter("jspPage", successForward); } catch (Exception e) { _log.debug(e.getMessage()); e.printStackTrace(); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", exceptionForward); } }
@ProcessAction(name = "applicationActionDeveloperDelete") public void applicationActionDeveloperDelete(ActionRequest request, ActionResponse response) { String errorForward = "/devel/error.jsp"; try { Application application = ApplicationLocalServiceUtil.fetchApplication(ParamUtil.getLong(request, "applicationId")); if (application != null) { ApplicationLocalServiceUtil.developerDeleteApplication(application); SessionMessages.add(request, "application-deleted-successfully"); } else { SessionErrors.add(request, "error-deleting-application"); // request.setAttribute("applicationId", ParamUtil.getLong(request, "applicationId")); } } catch (SystemException e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", errorForward); } }
/** * This Action gets a category from the database and puts it into the * request. It also sets the "jspPage" parameter to "editCategory" so that * processing is forwarded to edit_category.jsp. * * @param request * @param response * @throws PortalException * @throws java.lang.Exception */ @ProcessAction(name = "categoryDisplayUpdate") public void categoryDisplayUpdate(ActionRequest request, ActionResponse response) { try { long categoryId = ParamUtil.getLong(request, "categoryId"); if (Validator.isNotNull(categoryId)) { Category category = CategoryLocalServiceUtil.getCategory(categoryId); request.setAttribute("category", category); response.setRenderParameter("jspPage", contentEditCategoryJSP); } } catch (Exception e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", contentErrorJSP); } }
@ProcessAction(name = "categoryActionAdd") public void categoryActionAdd(ActionRequest request, ActionResponse response) { try { Category category = ActionUtil.categoryFromRequest(request); ArrayList<String> errors = new ArrayList<String>(); if (MyValidator.validateCategory(category, errors) ) { CategoryLocalServiceUtil.addCategory(category); SessionMessages.add(request, "category-added-successfully"); response.setRenderParameter("jspPage", "/content/view_categories.jsp"); } else { for (String error : errors) { SessionErrors.add(request, error); } SessionErrors.add(request, "error-saving-category"); request.setAttribute("category", category); response.setRenderParameter("jspPage", contentAddCategoryJSP); } } catch (SystemException e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", contentErrorJSP); } }
@ProcessAction(name = "categoryActionUpdate") public void categoryActionUpdate(ActionRequest request, ActionResponse response) { try { Category category = ActionUtil.categoryFromRequest(request); ArrayList<String> errors = new ArrayList<String>(); if (MyValidator.validateCategory(category, errors) ) { CategoryLocalServiceUtil.updateCategory(category); SessionMessages.add(request, "category-updated-successfully"); response.setRenderParameter("jspPage", "/content/view_categories.jsp"); } else { for (String error : errors) { SessionErrors.add(request, error); } SessionErrors.add(request, "error-updating-category"); request.setAttribute("category", category); response.setRenderParameter("jspPage", contentEditCategoryJSP); } } catch (SystemException e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", contentErrorJSP); } }
@ProcessAction(name = "categoryActionDelete") public void categoryActionDelete(ActionRequest request, ActionResponse response) { try { Category category = CategoryLocalServiceUtil.fetchCategory(ParamUtil.getLong(request, "categoryId")); if (category != null) { CategoryLocalServiceUtil.deleteCategory(category); SessionMessages.add(request, "category-deleted-successfully"); response.setRenderParameter("jspPage", "/content/view_categories.jsp"); } else { SessionErrors.add(request, "error-deleting-category"); request.setAttribute("categoryId", ParamUtil.getLong(request, "categoryId")); } } catch (SystemException e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", contentErrorJSP); } }
@ProcessAction(name = "entitlementActionAdd") public void entitlementActionAdd(ActionRequest request, ActionResponse response) { try { Entitlement entitlement = ActionUtil.entitlementFromRequest(request); ArrayList<String> errors = new ArrayList<String>(); if (MyValidator.validateEntitlement(entitlement, errors) ) { EntitlementLocalServiceUtil.addEntitlement(entitlement); SessionMessages.add(request, "entitlement-added-successfully"); response.setRenderParameter("jspPage", "/content/view_entitlements.jsp"); } else { for (String error : errors) { SessionErrors.add(request, error); } SessionErrors.add(request, "error-saving-entitlement"); request.setAttribute("entitlement", entitlement); response.setRenderParameter("jspPage", contentAddEntitlementJSP); } } catch (SystemException e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", contentErrorJSP); } }
@ProcessAction(name = "entitlementActionUpdate") public void entitlementActionUpdate(ActionRequest request, ActionResponse response) { try { Entitlement entitlement = ActionUtil.entitlementFromRequest(request); ArrayList<String> errors = new ArrayList<String>(); if (MyValidator.validateEntitlement(entitlement, errors) ) { EntitlementLocalServiceUtil.updateEntitlement(entitlement); SessionMessages.add(request, "entitlement-updated-successfully"); response.setRenderParameter("jspPage", "/content/view_entitlements.jsp"); } else { for (String error : errors) { SessionErrors.add(request, error); } SessionErrors.add(request, "error-saving-entitlement"); request.setAttribute("entitlement", entitlement); response.setRenderParameter("jspPage", contentEditEntitlementJSP); } } catch (SystemException e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", contentErrorJSP); } }
@ProcessAction(name = "entitlementActionDelete") public void entitlementActionDelete(ActionRequest request, ActionResponse response) { try { Entitlement entitlement = EntitlementLocalServiceUtil.fetchEntitlement(ParamUtil.getLong(request, "entitlementId")); if (entitlement != null) { EntitlementLocalServiceUtil.deleteEntitlement(entitlement); SessionMessages.add(request, "entitlement-deleted-successfully"); response.setRenderParameter("jspPage", "/content/view_entitlements.jsp"); } else { SessionErrors.add(request, "error-deleting-entitlement"); request.setAttribute("entitlementId", ParamUtil.getLong(request, "entitlementId")); } } catch (SystemException e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", contentErrorJSP); } }
@ProcessAction(name = "languageActionAdd") public void languageActionAdd(ActionRequest request, ActionResponse response) { try { Language language = ActionUtil.languageFromRequest(request); ArrayList<String> errors = new ArrayList<String>(); if (MyValidator.validateLanguage(language, errors) ) { LanguageLocalServiceUtil.addLanguage(language); SessionMessages.add(request, "language-added-successfully"); response.setRenderParameter("jspPage", "/content/view_languages.jsp"); } else { for (String error : errors) { SessionErrors.add(request, error); } SessionErrors.add(request, "error-saving-language"); request.setAttribute("language", language); response.setRenderParameter("jspPage", contentAddLanguageJSP); } } catch (SystemException e) { _log.debug(e.getMessage()); SessionErrors.add(request, "error-saving-language"); response.setRenderParameter("jspPage", contentAddLanguageJSP); } }
@ProcessAction(name = "languageActionUpdate") public void languageActionUpdate(ActionRequest request, ActionResponse response) { try { Language language = ActionUtil.languageFromRequest(request); ArrayList<String> errors = new ArrayList<String>(); if (MyValidator.validateLanguage(language, errors) ) { LanguageLocalServiceUtil.updateLanguage(language); SessionMessages.add(request, "language-updated-successfully"); response.setRenderParameter("jspPage", "/content/view_languages.jsp"); } else { for (String error : errors) { SessionErrors.add(request, error); } SessionErrors.add(request, "error-updating-language"); request.setAttribute("language", language); response.setRenderParameter("jspPage", contentEditLanguageJSP); } } catch (SystemException e) { _log.debug(e.getMessage()); SessionErrors.add(request, "error-updating-language"); response.setRenderParameter("jspPage", contentEditLanguageJSP); } }
@ProcessAction(name = "languageActionDelete") public void languageActionDelete(ActionRequest request, ActionResponse response) { try { Language language = LanguageLocalServiceUtil.fetchLanguage(ParamUtil.getLong(request, "languageId")); if (language != null) { LanguageLocalServiceUtil.deleteLanguage(language); SessionMessages.add(request, "language-deleted-successfully"); response.setRenderParameter("jspPage", "/content/view_languages.jsp"); } else { SessionErrors.add(request, "error-deleting-language"); request.setAttribute("languageId", ParamUtil.getLong(request, "languageId")); } } catch (SystemException e) { _log.debug(e.getMessage()); request.setAttribute("languageId", ParamUtil.getLong(request, "languageId")); } }
/** * This Action gets a regionId from the request and puts it as parentRegionId into the * request. It also sets the "jspPage" parameter to "contentAddRegionJSP" so that * processing is forwarded to add_region.jsp. * * @param request * @param response * @throws PortalException * @throws java.lang.Exception */ @ProcessAction(name = "regionDisplayAddSubRegion") public void regionDisplayAddSubRegion(ActionRequest request, ActionResponse response) { try { long parentRegionId = ParamUtil.getLong(request, "parentRegionId"); // _log.debug("parentRegionId: " + parentRegionId); if (Validator.isNotNull(parentRegionId)) { request.setAttribute("parentRegionId", parentRegionId); response.setRenderParameter("jspPage", contentAddRegionJSP); } } catch (Exception e) { _log.debug(e.getMessage()); request.setAttribute("languageId", ParamUtil.getLong(request, "languageId")); } }
@ProcessAction(name = "regionActionAdd") public void regionActionAdd(ActionRequest request, ActionResponse response) { try { Region region = ActionUtil.regionFromRequest(request); ArrayList<String> errors = new ArrayList<String>(); if (MyValidator.validateRegion(region, errors) ) { RegionLocalServiceUtil.addRegion(region); SessionMessages.add(request, "region-added-successfully"); response.setRenderParameter("jspPage", "/content/view_regions.jsp"); } else { for (String error : errors) { SessionErrors.add(request, error); } SessionErrors.add(request, "error-saving-region"); request.setAttribute("parentRegionId", region.getParentRegion()); response.setRenderParameter("jspPage", contentAddRegionJSP); } } catch (SystemException e) { _log.debug(e.getMessage()); request.setAttribute("languageId", ParamUtil.getLong(request, "languageId")); } }
@ProcessAction(name = "regionActionUpdate") public void regionActionUpdate(ActionRequest request, ActionResponse response) { try { Region region = ActionUtil.regionFromRequest(request); ArrayList<String> errors = new ArrayList<String>(); if (MyValidator.validateRegion(region, errors) ) { RegionLocalServiceUtil.updateRegion(region); SessionMessages.add(request, "region-updated-successfully"); response.setRenderParameter("jspPage", "/content/view_regions.jsp"); } else { for (String error : errors) { SessionErrors.add(request, error); } SessionErrors.add(request, "error-saving-region"); request.setAttribute("region", region); response.setRenderParameter("jspPage", contentEditRegionJSP); } } catch (SystemException e) { _log.debug(e.getMessage()); request.setAttribute("languageId", ParamUtil.getLong(request, "languageId")); } }
@ProcessAction(name = "regionActionDelete") public void regionActionDelete(ActionRequest request, ActionResponse response) { try { Region region = RegionLocalServiceUtil.fetchRegion(ParamUtil.getLong(request, "regionId")); if (region != null) { RegionLocalServiceUtil.deleteRegion(region); SessionMessages.add(request, "region-deleted-successfully"); response.setRenderParameter("jspPage", "/content/view_regions.jsp"); } else { SessionErrors.add(request, "error-deleting-region"); request.setAttribute("regionId", ParamUtil.getLong(request, "regionId")); } } catch (SystemException e) { _log.debug(e.getMessage()); request.setAttribute("languageId", ParamUtil.getLong(request, "languageId")); } }
@ProcessAction(name = "updateStatusString") public void updateStatusString(ActionRequest request, ActionResponse response) { String errorForward = "/content/error.jsp"; try { errorForward = ParamUtil.getString(request, "errorForward"); String successForward = ParamUtil.getString(request, "successForward"); List<Application> allApps = ApplicationLocalServiceUtil.getApplications(10154); for (Application application : allApps) { ApplicationLocalServiceUtil.updateStatusString(application.getApplicationId()); } SessionMessages.add(request, "application-updateStatusString-successfully"); response.setRenderParameter("jspPage", successForward); } catch (SystemException e) { _log.debug(e.getMessage()); SessionMessages.add(request, "application-updateStatusString-error"); response.setRenderParameter("jspPage", errorForward); } }
@ProcessAction(name = "removeWhitespaceFromTargetOS") public void removeWhitespaceFromTargetOS(ActionRequest request, ActionResponse response) { String errorForward = "/content/error.jsp"; try { errorForward = ParamUtil.getString(request, "errorForward"); String successForward = ParamUtil.getString(request, "successForward"); ApplicationLocalServiceUtil.removeWhitespaceFromTargetOS(); SessionMessages.add(request, "application-removeWhitespaceFromTargetOSURL-successfully"); response.setRenderParameter("jspPage", successForward); } catch (SystemException e) { _log.debug(e.getMessage()); SessionMessages.add(request, "application-removeWhitespaceFromTargetOSURL-error"); response.setRenderParameter("jspPage", errorForward); } }
@ProcessAction(name = "editmodule") public void editmodule(ActionRequest request, ActionResponse response) throws Exception { long key = ParamUtil.getLong(request, "resourcePrimKey"); if (Validator.isNotNull(key)) { response.setRenderParameter("moduleId", Long.toString(key)); try { response.setWindowState(LiferayWindowState.POP_UP); } catch (WindowStateException e) { if(log.isDebugEnabled())e.printStackTrace(); if(log.isErrorEnabled())log.error(e.getMessage()); } response.setRenderParameter("view", "editmodule"); response.setRenderParameter("editType", "edit"); } }
@ProcessAction(name = "deletemodule") public void deletemodule(ActionRequest request, ActionResponse response)throws Exception { long id = ParamUtil.getLong(request, "resourcePrimKey"); if (Validator.isNotNull(id)) { Module module = ModuleLocalServiceUtil.getModule(id); ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); List<LearningActivity> moduleActivities = LearningActivityLocalServiceUtil.getLearningActivitiesOfModule(id); for(LearningActivity la : moduleActivities){ deleteActivity(la, themeDisplay, request, response); } ModuleLocalServiceUtil.deleteModule(module); //MultiVMPoolUtil.clear(); SessionMessages.add(request, "module-deleted-successfully"); } else { SessionErrors.add(request, "module-error-deleting"); } }
@ProcessAction(name = "setmodulePref") public void setmodulePref(ActionRequest request, ActionResponse response) throws Exception { String rowsPerPage = ParamUtil.getString(request, "module-rows-per-page"); String dateFormat = ParamUtil.getString(request, "module-date-format"); String datetimeFormat = ParamUtil.getString(request, "module-datetime-format"); ArrayList<String> errors = new ArrayList<String>(); if (moduleValidator.validateEditmodule(rowsPerPage, dateFormat, datetimeFormat, errors)) { response.setRenderParameter("module-rows-per-page", ""); response.setRenderParameter("module-date-format", ""); response.setRenderParameter("module-datetime-format", ""); PortletPreferences prefs = request.getPreferences(); prefs.setValue("module-rows-per-page", rowsPerPage); prefs.setValue("module-date-format", dateFormat); prefs.setValue("module-datetime-format", datetimeFormat); prefs.store(); SessionMessages.add(request, "module-prefs-success"); } }
@ProcessAction(name="checkgroups") public void checkgroups(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); List<Course> courses = CourseLocalServiceUtil.findByCompanyId(themeDisplay.getCompanyId()); int counter = 0; for(Course course: courses){ if(log.isDebugEnabled())log.debug("Course::"+course.getCourseId()); Group group = GroupLocalServiceUtil.getGroup(course.getGroupCreatedId()); ClassName cn = ClassNameLocalServiceUtil.getClassName(Course.class.getName()); if(!group.getClassName().equals(Course.class.getName())){ if(log.isDebugEnabled())log.debug("Change!"+group.getGroupId()); group.setClassNameId(cn.getClassNameId()); group.setClassPK(course.getCourseId()); GroupLocalServiceUtil.updateGroup(group); counter++; } } actionResponse.setRenderParameter("counter", String.valueOf(counter)); SessionMessages.add(actionRequest, "ok"); }
@ProcessAction(name = "viewHistory") public final void viewHistory(ActionRequest req, ActionResponse rsp) throws PortalException, SystemException { ChatRoom room = ChatPortletRequestUtil.getChatRoomFromRequest(req); if (room == null) { SessionErrors.add(req, "room-cant-find"); rsp.setRenderParameter(ChatPortletConstants.VIEW_PARAM, ChatRoomView.LIST.getUrlParamValue()); return; } if (room.getStatus() != RoomStatus.Exported.getValue()) { SessionErrors.add(req, "room-not-exported"); rsp.setRenderParameter(ChatPortletConstants.VIEW_PARAM, ChatRoomView.LIST.getUrlParamValue()); return; } addPreviousPageLinkParameter(req, rsp); rsp.setRenderParameter(ChatPortletConstants.VIEW_PARAM, ChatRoomView.HISTORY.getUrlParamValue()); rsp.setRenderParameter(ChatPortletConstants.ROOM_ID_PARAM, Long.toString(room.getRoomId())); }
@ProcessAction(name = "autentica") public void autenticaUsuario(ActionRequest request, ActionResponse response) throws IOException { String email = request.getParameter("email"); String senha = request.getParameter("senha"); if (tentaAutenticar(request, response, email, senha)) { PortletSession session = request.getPortletSession(false); if (session != null) { session.removeAttribute("email"); } redirecionaParaUfOuAtual(request, response, email); } else { request.getPortletSession().setAttribute("email", email); } }
@ProcessAction(name = "resetPersonalizedTheme") public void resetAction(ActionRequest request, ActionResponse response) throws IOException { try { ThemeDisplay themeDisplay = (ThemeDisplay) request .getAttribute(WebKeys.THEME_DISPLAY); UserPersonalizedTheme userPersonalizedTheme = UserPersonalizedThemeLocalServiceUtil .findByUserIDAndLayoutId(themeDisplay.getCompanyId(), themeDisplay.getUserId(), themeDisplay.getLayout() .getLayoutId()); UserPersonalizedThemeLocalServiceUtil .deleteUserPersonalizedTheme(userPersonalizedTheme); SessionMessages.add(request, "theme-personalization-restored-to-default"); sendRedirect(request, response); } catch (SystemException e) { SessionErrors.add(request, "system-error-please-contact-adminstrator"); _log.error("Error removing personalized theme information", e); } }
/** * This Action sets the "jspPage" parameter to "ActionRequest-param successForward" so that * processing is forwarded to ActionRequest-param successForward. * * @param request * @param response * ActionRequest-param exceptionForward * ActionRequest-param successForward * @throws PortalException * @throws java.lang.Exception */ @ProcessAction(name = "redirectAction") public void redirectAction(ActionRequest request, ActionResponse response) { String exceptionForward = "/devel/error.jsp"; try { exceptionForward = ParamUtil.getString(request, "exceptionForward"); String successForward = ParamUtil.getString(request, "successForward"); response.setRenderParameter("jspPage", successForward); } catch (Exception e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", exceptionForward); } }
/** * This Action gets a categoryId from the request and puts it as parentCategoryId into the * request. It also sets the "jspPage" parameter to "contentAddCategoryJSP" so that * processing is forwarded to add_category.jsp. * * @param request * @param response * @throws PortalException * @throws java.lang.Exception */ @ProcessAction(name = "categoryDisplayAddSubCategory") public void categoryDisplayAddSubCategory(ActionRequest request, ActionResponse response) { try { long parentCategoryId = ParamUtil.getLong(request, "parentCategoryId"); if (Validator.isNotNull(parentCategoryId)) { request.setAttribute("parentCategoryId", parentCategoryId); response.setRenderParameter("jspPage", contentAddCategoryJSP); } } catch (Exception e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", contentErrorJSP); } }
/** * This Action sets the "jspPage" parameter to "contentAddEntitlementJSP" so that * processing is forwarded to add_entitlement.jsp. * * @param request * @param response * @throws PortalException * @throws java.lang.Exception */ @ProcessAction(name = "entitlementDisplayAdd") public void entitlementDisplayAdd(ActionRequest request, ActionResponse response) { try { response.setRenderParameter("jspPage", contentAddEntitlementJSP); } catch (Exception e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", contentErrorJSP); } }
/** * This Action sets the "jspPage" parameter to "contentAddLanguageJSP" so that * processing is forwarded to add_language.jsp. * * @param request * @param response * @throws PortalException * @throws java.lang.Exception */ @ProcessAction(name = "languageDisplayAdd") public void languageDisplayAdd(ActionRequest request, ActionResponse response) { try { response.setRenderParameter("jspPage", contentAddLanguageJSP); } catch (Exception e) { _log.debug(e.getMessage()); request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", contentErrorJSP); } }
/** * This Action sets the "jspPage" parameter to "addApplicationPreambleJSP" * so that processing is forwarded to add_application.jsp. * * @param request * @param response * @throws PortalException * @throws java.lang.Exception */ @ProcessAction(name = "addApplicationPreamble") public void addApplicationPreamble(ActionRequest request, ActionResponse response) { _applicationPortletLog.debug("addApplicationPreamble"); try { response.setRenderParameter("jspPage", addApplicationPreambleJSP); } catch (Exception e) { request.setAttribute("errorMsg", e.getMessage()); response.setRenderParameter("jspPage", errorJSP); } }
@ProcessAction(name="deleteCompetence") public void deleteCompetence(ActionRequest request, ActionResponse response)throws Exception { long id = ParamUtil.getLong(request, "competenceId"); if (Validator.isNotNull(id)) { if(log.isDebugEnabled())log.debug("deleteCompetence"); ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(),"portletClassLoader"); DynamicQuery dq = DynamicQueryFactoryUtil.forClass(CourseCompetence.class,classLoader) .add(PropertyFactoryUtil.forName("competenceId").eq(id)); List<CourseCompetence> courseCompetences = CourseCompetenceLocalServiceUtil.dynamicQuery(dq); if(courseCompetences!=null&&courseCompetences.size()>0){ SessionErrors.add(request, "competence.courseCompetence-in-use"); return; } dq = DynamicQueryFactoryUtil.forClass(UserCompetence.class,classLoader) .add(PropertyFactoryUtil.forName("competenceId").eq(id)); List<UserCompetence> userCompetences = UserCompetenceLocalServiceUtil.dynamicQuery(dq); if(userCompetences!=null&&userCompetences.size()>0){ SessionErrors.add(request, "competence.userCompetence-in-use"); return; } CompetenceLocalServiceUtil.deleteCompetence(id); } }
@ProcessAction(name="activateCompetence") public void activateCompetence(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { Long courseId = ParamUtil.getLong(actionRequest, "courseId"); Long competenceId = ParamUtil.getLong(actionRequest, "competenceId"); Boolean condition = ParamUtil.getBoolean(actionRequest, "condition"); String tab = ParamUtil.getString(actionRequest, "tab"); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); CourseCompetence cc = CourseCompetenceLocalServiceUtil.fetchByCourseCompetenceCondition(courseId, competenceId, condition); if(cc==null){ long courseCompetenceId = CounterLocalServiceUtil.increment(CourseCompetence.class.getName()); cc = CourseCompetenceLocalServiceUtil.createCourseCompetence(courseCompetenceId); cc.setCourseId(courseId); cc.setCompetenceId(competenceId); cc.setCachedModel(condition); cc.setCondition(condition); CourseCompetenceLocalServiceUtil.updateCourseCompetence(cc, true); } actionResponse.setRenderParameter("jspPage","/html/courseadmin/competencetab.jsp"); actionResponse.setRenderParameter("courseId", String.valueOf(courseId)); actionResponse.setRenderParameter("competenceId", String.valueOf(competenceId)); if(log.isDebugEnabled())log.debug("tab::"+tab); if(tab.equals("1")){ actionResponse.setRenderParameter("tabs1", LanguageUtil.get(themeDisplay.getLocale(),"competences.necessary")); }else{ actionResponse.setRenderParameter("tabs1", LanguageUtil.get(themeDisplay.getLocale(),"competences.assigned")); } }