/* * Process the "finished" action for the edit page. Set the "url" to the value specified in the * edit page. */ private void processEditFinishedAction(ActionRequest request, ActionResponse response) throws PortletException { String nbPublis = request.getParameter(TEXTBOX_NB_ITEMS); String maxAge = request.getParameter(TEXTBOX_MAX_AGE); String displayDescription = request.getParameter("displayDescription"); // Check if it is a number try { int nb = Integer.parseInt(nbPublis); Integer.parseInt(maxAge); if (nb < 0 || nb > 30) { throw new NumberFormatException(); } // store preference PortletPreferences pref = request.getPreferences(); try { pref.setValue("nbPublis", nbPublis); pref.setValue("maxAge", maxAge); pref.setValue("displayDescription", displayDescription); pref.store(); } catch (ValidatorException ve) { log("could not set nbPublis", ve); throw new PortletException("IFramePortlet.processEditFinishedAction", ve); } catch (IOException ioe) { log("could not set nbPublis", ioe); throw new PortletException("IFramePortlet.prcoessEditFinishedAction", ioe); } response.setPortletMode(PortletMode.VIEW); } catch (NumberFormatException e) { response.setRenderParameter(ERROR_BAD_VALUE, "true"); response.setPortletMode(PortletMode.EDIT); } }
/** * @see de.ingrid.portal.portlets.admin.ContentPortlet#processAction(javax.portlet.ActionRequest, * javax.portlet.ActionResponse) */ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { if (request.getParameter(PARAMV_ACTION_DB_DO_SAVE) != null) { AdminCMSForm f = (AdminCMSForm) Utils.getActionForm(request, AdminCMSForm.SESSION_KEY, AdminCMSForm.class); f.clear(); f.clearMessages(); // call sub method doActionSave(request); response.setRenderParameter(Settings.PARAM_ACTION, PARAMV_ACTION_DB_DO_SAVE); response.setRenderParameter("cmd", "action processed"); } else if (request.getParameter(PARAMV_ACTION_DB_DO_UPDATE) != null) { AdminCMSForm f = (AdminCMSForm) Utils.getActionForm(request, AdminCMSForm.SESSION_KEY, AdminCMSForm.class); f.clear(); f.clearMessages(); // call sub method doActionUpdate(request); response.setRenderParameter(Settings.PARAM_ACTION, PARAMV_ACTION_DB_DO_UPDATE); response.setRenderParameter("cmd", "action processed"); } else { super.processAction(request, response); } }
public Registrant(ActionRequest request) { super(); isMale = false; password = request.getParameter(PortalConstants.PASSWORD); password2 = request.getParameter(PortalConstants.PASSWORD_REPEAT); setWantsMailNotification(true); }
@ProcessAction(name = "searchBookAction") public void searchBook(ActionRequest request, ActionResponse response) throws PortletException, IOException { logger.info("Inside search Book action"); request.setAttribute("myaction", "searchBookAction"); PortletRequestDispatcher dispatcher = request .getPortletSession() .getPortletContext() .getRequestDispatcher(response.encodeURL("/myservlet/bookServlet")); dispatcher.include(request, response); response.setRenderParameter("myaction", "showSearchResults"); // --store the search criteria in session request .getPortletSession() .setAttribute( "authorNameSearchField", request.getParameter("authorNameSearchField"), PortletSession.APPLICATION_SCOPE); request .getPortletSession() .setAttribute( "bookNameSearchField", request.getParameter("bookNameSearchField"), PortletSession.APPLICATION_SCOPE); // retrieving the matchingBooks request attribute set by BookServlet and // store it in session request .getPortletSession() .setAttribute("matchingBooks", request.getAttribute("matchingBooks")); }
/* * Process Action. */ @Override public void processAction(ActionRequest request, ActionResponse response) throws PortletException { if (request.getParameter(SUBMIT_FINISHED) != null) { processEditFinishedAction(request, response); } else if (request.getParameter(SUBMIT_CANCEL) != null) { processEditCancelAction(request, response); } }
private void _deleteScheduler( ActionRequest req, ActionResponse res, PortletConfig config, ActionForm form, User user) throws Exception { ContentImporterForm contentImporterForm = (ContentImporterForm) form; if (UtilMethods.isSet(contentImporterForm.getJobGroup())) QuartzUtils.removeJob(contentImporterForm.getJobName(), contentImporterForm.getJobGroup()); else QuartzUtils.removeJob(req.getParameter("name"), req.getParameter("group")); SessionMessages.add(req, "message", "message.Scheduler.delete"); }
public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { _log.info("***processAction****"); boolean error = false; String saveButton = (String) request.getParameter("saveButton"); String resetButton = (String) request.getParameter("resetButton"); _log.info("saveButton: " + saveButton); _log.info("resetButton: " + resetButton); String nameTelescope = (String) request.getParameter("nameTelescope"); String nameObservatory = (String) request.getParameter("nameObservatory"); String briefDescription = (String) request.getParameter("briefDescription"); String nameCountry = (String) request.getParameter("nameCountry"); String nameCity = (String) request.getParameter("nameCity"); String latitude = (String) request.getParameter("latitude"); String longitude = (String) request.getParameter("longitude"); String urlTelescope = (String) request.getParameter("urlTelescope"); _log.info("nameTelescope: " + nameTelescope); _log.info("nameObservatory: " + nameObservatory); _log.info("briefDescription: " + briefDescription); _log.info("nameCountry: " + nameCountry); _log.info("nameCity: " + nameCity); _log.info("latitude: " + latitude); _log.info("longitude: " + longitude); _log.info("urlTelescope: " + urlTelescope); ThemeDisplay td = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); User user = td.getUser(); _log.info("user: "******"error01"); } try { repository.registerObservatory(nameObservatory, nameCity, nameCountry); } catch (RTRepositoryException_Exception e) { error = true; _log.error(e.getMessage()); } catch (Exception e) { _log.error(e.getMessage()); } finally { SessionErrors.add(request, "error01"); } if (!error) SessionMessages.add(request, "success"); }
/** * @see * org.apache.portals.bridges.velocity.GenericVelocityPortlet#processAction(javax.portlet.ActionRequest, * javax.portlet.ActionResponse) */ public void processAction(ActionRequest request, ActionResponse actionResponse) throws PortletException, IOException { String action = request.getParameter(Settings.PARAM_ACTION); if (action == null) { action = ""; } PortletSession session = request.getPortletSession(); if (action.equalsIgnoreCase("doOpenPartner")) { DisplayTreeNode partnerRoot = (DisplayTreeNode) session.getAttribute("partnerRoot"); if (partnerRoot != null) { DisplayTreeNode node = partnerRoot.getChild(request.getParameter("id")); node.setOpen(true); if (node.get("checked") != null) { Iterator it = node.getChildren().iterator(); while (it.hasNext()) { DisplayTreeNode child = (DisplayTreeNode) it.next(); child.put("checked", "true"); } } } } else if (action.equalsIgnoreCase("doClosePartner")) { DisplayTreeNode partnerRoot = (DisplayTreeNode) session.getAttribute("partnerRoot"); if (partnerRoot != null) { DisplayTreeNode node = partnerRoot.getChild(request.getParameter("id")); node.setOpen(false); } } else if (action.equalsIgnoreCase("doOriginalSettings")) { Principal principal = request.getUserPrincipal(); IngridPersistencePrefs.setPref( principal.getName(), IngridPersistencePrefs.SEARCH_PARTNER, ""); DisplayTreeNode partnerRoot = (DisplayTreeNode) session.getAttribute("partnerRoot"); Iterator it = partnerRoot.getChildren().iterator(); while (it.hasNext()) { DisplayTreeNode partnerNode = (DisplayTreeNode) it.next(); partnerNode.setOpen(false); Iterator it2 = partnerNode.getChildren().iterator(); while (it2.hasNext()) { DisplayTreeNode providerNode = (DisplayTreeNode) it2.next(); providerNode.remove("checked"); } } } else { // Zur Suchanfrage hinzufuegen DisplayTreeNode partnerRoot = (DisplayTreeNode) session.getAttribute("partnerRoot"); String resultQuery = UtilsSearch.processSearchPartner("", partnerRoot, request); Principal principal = request.getUserPrincipal(); IngridPersistencePrefs.setPref( principal.getName(), IngridPersistencePrefs.SEARCH_PARTNER, resultQuery); } }
@RequestMapping("EDIT") public void savePreferences( ActionRequest request, ActionResponse response, @RequestParam("topicsToUpdate") Integer topicsToUpdate) throws PortletException { List<TopicSubscription> newSubscription = new ArrayList<TopicSubscription>(); for (int i = 0; i < topicsToUpdate; i++) { Long topicId = Long.valueOf(request.getParameter("topicId_" + i)); // Will be numeric for existing, persisted TopicSubscription // instances; blank (due to null id field) otherwise String topicSubId = request.getParameter("topicSubId_" + i).trim(); Boolean subscribed = Boolean.valueOf(request.getParameter("subscribed_" + i)); Topic topic = announcementService.getTopic(topicId); // Make sure that any pushed_forced topics weren't sneakingly removed (by tweaking the URL, // for example) if (topic.getSubscriptionMethod() == Topic.PUSHED_FORCED) { subscribed = new Boolean(true); } TopicSubscription ts = new TopicSubscription(request.getRemoteUser(), topic, subscribed); if (topicSubId.length() > 0) { // This TopicSubscription represents an existing, persisted entity try { ts.setId(Long.valueOf(topicSubId)); } catch (NumberFormatException nfe) { logger.debug(nfe.getMessage(), nfe); } } newSubscription.add(ts); } if (newSubscription.size() > 0) { try { announcementService.addOrSaveTopicSubscription(newSubscription); } catch (Exception e) { logger.error( "ERROR saving TopicSubscriptions for user " + request.getRemoteUser() + ". Message: " + e.getMessage()); } } response.setPortletMode(PortletMode.VIEW); response.setRenderParameter("action", "displayAnnouncements"); }
private void doSelection(ActionRequest request, ActionResponse response) { // System.out.println("[BrowserPortlet.doSelection]"); String url = request.getParameter("url"); HTMLPage page = new HTMLPage(); page.setURL("url"); try { page.extractTitle(); } catch (ParserException e) { // TODO Auto-generated catch block e.printStackTrace(); } String title = page.getTitle(); // String title = HTMLmanager.getTitlePage(url) ; SelectionHTML _selection_html = new SelectionHTML(); _selection_html.setHTMLContent(request.getParameter("text_selection")); _selection_html.setXpointerBegin(request.getParameter("xpointer_start")); _selection_html.setXpointerEnd(request.getParameter("xpointer_end")); _selection_html.setContextCreation("PortletWebBrowser"); _selection_html.setCreation(new Date()); _selection_html.setLabel("sélection de : " + title); // _selection_html.setRepresentsResource(representsResource); WebPage selectionOrigin = new WebPage(); URI _access = new URI(); _access.setEffectiveURI(url); selectionOrigin.setAccess(_access); selectionOrigin.setContextCreation("PortletWebBrowser"); selectionOrigin.setCreation(new Date()); // TODO // Pas la peine de sauver tout le html pour l'instant // selectionOrigin.setHTMLContent(HTMLmanager.getCleanHTML(url)); selectionOrigin.setLabel(title); selectionOrigin.setPrincipalURL(_access); selectionOrigin.setRepresentsResource(_access); _selection_html.setSelectionOrigin(selectionOrigin); HighlightSelectionHTML _highLight = new HighlightSelectionHTML(); _highLight.setSelection(_selection_html); _highLight.setStyle("background-color:yellow;"); _highLight.setInfo("sélection en attente d'annotation"); _highLight.setId(generateHighlightId(request)); // _selection_html.setClassname("new_selection"); this.sendEvent("selection", _highLight, response); // ajouter la nouvelle sélection à la liste courante ArrayList<HighlightSelectionHTML> _highlights; if (request.getPortletSession().getAttribute("highlights") != null) { _highlights = (ArrayList<HighlightSelectionHTML>) request.getPortletSession().getAttribute("highlights"); } else _highlights = new ArrayList<HighlightSelectionHTML>(); _highlights.add(_highLight); request.getPortletSession().setAttribute("highlights", _highlights); // response.setRenderParameter("url", url); request.getPortletSession().setAttribute("current_url", url); }
public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { String action = request.getParameter(Settings.PARAM_ACTION); if (action == null) { action = ""; } if (action.equalsIgnoreCase(Settings.PARAMV_ACTION_CHANGE_TAB)) { String newTab = request.getParameter(Settings.PARAM_TAB); processTab(response, newTab); } else { UtilsSearch.processActionForPartnerPortlet(request, response, PAGE_PARTNER); } }
private void doPage(ActionRequest request, ActionResponse response) { // System.out.println("[BrowserPortlet.doPage]"); String url = request.getParameter("url"); WebPage _page = new WebPage(); URI _access = new URI(); _access.setEffectiveURI(url); _page.setAccess(_access); _page.setContextCreation("PortletWebBrowser"); _page.setCreation(new Date()); // TODO pour l'instant on se fout du contenu de la page // _page.setHTMLContent(HTMLmanager.getCleanHTML(url)); HTMLPage page = new HTMLPage(); page.setURL(url); try { page.extractTitle(); } catch (ParserException e) { // TODO Auto-generated catch block e.printStackTrace(); } String title = page.getTitle(); // String title = HTMLmanager.getTitlePage(url) ; _page.setLabel(title); _page.setPrincipalURL(_access); _page.setRepresentsResource(_access); this.sendEvent("page", _page, response); // response.setRenderParameter("url", url); request.getPortletSession().setAttribute("current_url", url); }
public void processAction( ActionMapping mapping, ActionForm form, PortletConfig config, ActionRequest req, ActionResponse res) throws Exception { String cmd = req.getParameter(Constants.CMD); if ((cmd != null) && (cmd.equals(Constants.ADD))) { try { _import(req, res); } catch (Exception e) { if (e != null && e instanceof ContactEmailAddressException || e instanceof ContactFirstNameException || e instanceof ContactLastNameException || e instanceof DuplicateContactException || e instanceof UploadException) { SessionErrors.add(req, e.getClass().getName()); setForward(req, "portlet.address_book.import_export"); } else { req.setAttribute(PageContext.EXCEPTION, e); setForward(req, Constants.COMMON_ERROR); } } } else { setForward(req, "portlet.address_book.import_export"); } }
// Process action is called for action URLs / form posts, etc // Process action is called once for each click - doView may be called many times // Hence an obsession in process action with putting things in session to // Send to the render process. public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { // System.out.println("==== processAction called ===="); PortletSession pSession = request.getPortletSession(true); // Our first challenge is to figure out which action we want to take // The view selects the "next action" either as a URL parameter // or as a hidden field in the POST data - we check both String doCancel = request.getParameter("sakai.cancel"); String doUpdate = request.getParameter("sakai.update"); // Our next challenge is to pick which action the previous view // has told us to do. Note that the view may place several actions // on the screen and the user may have an option to pick between // them. Make sure we handle the "no action" fall-through. pSession.removeAttribute("error.message"); if (doCancel != null) { response.setPortletMode(PortletMode.VIEW); } else if (doUpdate != null) { processActionEdit(request, response); } else { // System.out.println("Unknown action"); response.setPortletMode(PortletMode.VIEW); } // System.out.println("==== End of ProcessAction ===="); }
protected void handleActionRequestInternal(ActionRequest request, ActionResponse response) throws Exception { Integer relTypeId = null; try { relTypeId = Integer.valueOf(request.getParameter("relTypeId")); } catch (Exception ex) { throw new RuntimeException( "Error getting relationship type ID from request: " + ex.getMessage(), ex); } CatalogEntryRelationshipType relType = getCatalogEntryRelationshipTypeDao().getById(relTypeId); if (relType == null) { throw new RuntimeException("Couldn't find relationship type for id: " + relTypeId); } HibernateTemplate templ = getCatalogEntryRelationshipTypeDao().getHibernateTemplate(); CatalogEntryRoleType roleTypeA = relType.getRoleTypeA(); roleTypeA.setRelationshipType(null); relType.setRoleTypeA(null); templ.save(roleTypeA); CatalogEntryRoleType roleTypeB = relType.getRoleTypeB(); roleTypeB.setRelationshipType(null); relType.setRoleTypeB(null); templ.save(roleTypeB); templ.save(relType); templ.delete(roleTypeA); templ.delete(roleTypeB); templ.delete(relType); getCatalogEntryRelationshipTypeDao().getHibernateTemplate().flush(); getUserModel().setCurrentRelationshipType(null); }
protected void login( ThemeDisplay themeDisplay, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { HttpServletRequest request = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(actionRequest)); HttpServletResponse response = PortalUtil.getHttpServletResponse(actionResponse); String login = ParamUtil.getString(actionRequest, "login"); String password = actionRequest.getParameter("password"); boolean rememberMe = ParamUtil.getBoolean(actionRequest, "rememberMe"); if (!themeDisplay.isSignedIn()) { String portletId = PortalUtil.getPortletId(actionRequest); PortletPreferences portletPreferences = PortletPreferencesFactoryUtil.getStrictPortletSetup(themeDisplay.getLayout(), portletId); String authType = portletPreferences.getValue("authType", null); AuthenticatedSessionManagerUtil.login( request, response, login, password, rememberMe, authType); } String redirect = ParamUtil.getString(actionRequest, "redirect"); if (Validator.isNotNull(redirect)) { redirect = PortalUtil.escapeRedirect(redirect); if (Validator.isNotNull(redirect) && !redirect.startsWith(Http.HTTP)) { redirect = getCompleteRedirectURL(request, redirect); } } String mainPath = themeDisplay.getPathMain(); if (PropsValues.PORTAL_JAAS_ENABLE) { if (Validator.isNotNull(redirect)) { redirect = mainPath.concat("/portal/protected?redirect=").concat(HttpUtil.encodeURL(redirect)); } else { redirect = mainPath.concat("/portal/protected"); } actionResponse.sendRedirect(redirect); } else { if (Validator.isNotNull(redirect)) { actionResponse.sendRedirect(redirect); } else { boolean doActionAfterLogin = ParamUtil.getBoolean(actionRequest, "doActionAfterLogin"); if (doActionAfterLogin) { return; } else { actionResponse.sendRedirect(mainPath); } } } }
public void processAction(ActionRequest req, ActionResponse res) throws IOException, PortletException { try { String cmd = ParamUtil.getString(req, Constants.CMD); if (cmd.equals(Constants.SEND)) { String selectTo = req.getParameter("select_to"); String to = req.getParameter("to"); String subject = ParamUtil.getString(req, "subject"); String message = ParamUtil.getString(req, "message"); if (!Validator.isEmailAddress(selectTo) && !Validator.isEmailAddress(to)) { SessionErrors.add(req, "to_invalid"); } else if (!Validator.isEmailAddress(to)) { to = selectTo; } if (SessionErrors.isEmpty(req)) { User user = PortalUtil.getUser(req); MailServiceUtil.sendEmail( new MailMessage( new InternetAddress(user.getEmailAddress(), user.getFullName()), new InternetAddress(to), subject, message)); res.setRenderParameter("select_to", StringPool.BLANK); res.setRenderParameter("to", StringPool.BLANK); res.setRenderParameter("subject", StringPool.BLANK); res.setRenderParameter("message", StringPool.BLANK); SessionMessages.add(req, getPortletConfig().getPortletName() + ".send", to); } else { res.setRenderParameter("select_to", selectTo); res.setRenderParameter("to", to); res.setRenderParameter("subject", subject); res.setRenderParameter("message", message); } } } catch (Exception e) { throw new PortletException(e); } }
public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException { // grab parameters - they will be cleared in processing of edit response String webContentParameter = actionRequest.getParameter(WebContentRewriter.ACTION_PARAMETER_URL); String ssoPrincipalName = actionRequest.getParameter(SSO_EDIT_FIELD_PRINCIPAL); String ssoPrincipalPassword = actionRequest.getParameter(SSO_EDIT_FIELD_CREDENTIAL); // save the prefs super.processAction(actionRequest, actionResponse); // process credentials if (webContentParameter == null || actionRequest.getPortletMode() == PortletMode.EDIT) { // processPreferencesAction(request, actionResponse); // get the POST params -- requires HTML post params named above String siteUrl = actionRequest.getPreferences().getValue("SRC", ""); String localUser = actionRequest.getUserPrincipal().getName(); SSOSite site = sso.getSiteByUrl(siteUrl); try { if (!SecurityHelper.isEmpty(siteUrl) && !SecurityHelper.isEmpty(ssoPrincipalName) && !SecurityHelper.isEmpty(ssoPrincipalPassword)) { if (site == null) { site = sso.newSite(siteUrl, siteUrl); sso.addSite(site); SSOPortletUtil.updateUser( sso, actionRequest, site, ssoPrincipalName, ssoPrincipalPassword); } else { SSOPortletUtil.updateUser( sso, actionRequest, site, ssoPrincipalName, ssoPrincipalPassword); } } } catch (SSOException e) { String errorMessage = "Failed to add remote user for the portal principal, " + actionRequest.getUserPrincipal().getName() + "."; if (e.getCause() != null) { errorMessage += " (" + e.getCause() + ")"; } StatusMessage statusMessage = new StatusMessage(errorMessage, StatusMessage.ERROR); PortletMessaging.publish(actionRequest, "SSOWebContent", "status", statusMessage); actionResponse.setPortletMode(PortletMode.EDIT); // stay on edit } } }
private void doGo(ActionRequest request, ActionResponse response, StringBuffer message) throws ReadOnlyException, ValidatorException, IOException, PortletModeException { boolean save = true; // PortletPreferences prefs = request.getPreferences(); String url = request.getParameter("url"); if (!url.startsWith("http://")) { save = false; message.append("URLs must start with 'http://'<br/>"); response.setRenderParameter("message", message.toString()); response.setPortletMode(PortletMode.VIEW); } if (save) { request.getPortletSession().removeAttribute("highlights"); // response.setRenderParameter("url", url.toLowerCase()); // request.getPortletSession().setAttribute("current_url", url.toLowerCase()); request.getPortletSession().setAttribute("current_url", url); this.sendEvent("loadedurl", url, response); response.setPortletMode(PortletMode.VIEW); request.getPortletSession().removeAttribute("highlights"); // gestion de la consultation if (request.getPortletSession().getAttribute("consult_url") != null) // si une consultation a déjà commencé { if (!url.equalsIgnoreCase( (String) request .getPortletSession() .getAttribute("consult_url"))) // si on change de page à consulter { if (request.getPortletSession().getAttribute("user") != null) { // creates consultation // URI uri = // CREATOR_URI.createAndGetURI((String)request.getPortletSession().getAttribute("consult_url")); // CREATOR_CONSULTATION.createsConsultation((UserAccount)request.getPortletSession().getAttribute("user"), (Date)request.getPortletSession().getAttribute("start_consult") , new Date(), uri, "[PortletWebBrowse]"); URI uri = daoResource.createAndGetURI( (String) request.getPortletSession().getAttribute("consult_url")); daoConsultation.createsConsultation( (UserAccount) request.getPortletSession().getAttribute("user"), (Date) request.getPortletSession().getAttribute("start_consult"), new Date(), uri, "[PortletWebBrowse]"); } request.getPortletSession().setAttribute("consult_url", url); request.getPortletSession().setAttribute("start_consult", new Date()); } } else // si c'est la première consultation { request.getPortletSession().setAttribute("consult_url", url); request.getPortletSession().setAttribute("start_consult", new Date()); } } }
private CronScheduledTask _retrieveScheduler( ActionRequest req, ActionResponse res, PortletConfig config, ActionForm form) throws Exception { ContentImporterForm contentImporterForm = (ContentImporterForm) form; List<ScheduledTask> results = null; if (UtilMethods.isSet(contentImporterForm.getJobGroup())) { results = (List<ScheduledTask>) QuartzUtils.getStandardScheduledTask( contentImporterForm.getJobName(), contentImporterForm.getJobGroup()); } else { results = (List<ScheduledTask>) QuartzUtils.getStandardScheduledTask( req.getParameter("name"), req.getParameter("group")); } if (results.size() > 0) return (CronScheduledTask) results.get(0); else return null; }
/** * Delete quote from databse. * * @param request Request for get quote id. * @param model Model for return message. */ @ActionMapping(DELETE_ACTION) public final void deleteQuoteAction(final ActionRequest request, final Model model) { final int quoteId = Integer.parseInt(request.getParameter(PARAMETER_QUOTE_ID)); final boolean deleted = getQuoteService().delete(quoteId); if (deleted) { model.addAttribute("successMessage", "Quote was deleted."); } else { model.addAttribute("errorMessage", "Quote was not deleted!"); } }
public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { _log.debug("ACTION"); String deleteblog = request.getParameter("deleteblog"); // Business Invocation BlogAPI blogService = blogService(); blogService.removeBlog(deleteblog); }
public void process(ActionRequest request, ActionResponse response) throws PortletException, IOException { final PortletPreferences prefs = request.getPreferences(); final Boolean stripScriptComments = new Boolean(request.getParameter(SCRIPTSTRIPCOMMENT)); prefs.setValue(SCRIPTSTRIPCOMMENT, stripScriptComments.toString()); final Boolean insertDocType = new Boolean(request.getParameter(INSERTDOCTYPE)); prefs.setValue(INSERTDOCTYPE, insertDocType.toString()); final Boolean stripComments = new Boolean(request.getParameter(STRIPCOMMENTS)); prefs.setValue(STRIPCOMMENTS, stripComments.toString()); final Boolean balanceTags = new Boolean(request.getParameter(BALANCETAGS)); prefs.setValue(BALANCETAGS, balanceTags.toString()); final Boolean reportErrors = new Boolean(request.getParameter(REPORTERRORS)); prefs.setValue(REPORTERRORS, reportErrors.toString()); prefs.store(); }
@ProcessAction(name = "uploadTocAction") public void uploadToc(ActionRequest request, ActionResponse response) throws PortletException, IOException { logger.info("Inside uploadToc action method"); if (!request.isUserInRole("administrator")) { response.setRenderParameter("myaction", "error"); response.setRenderParameter( "exceptionMsg", "You are not authorized for this action. You must have Administrator role."); return; } String isbnNumber = (String) request.getPortletSession().getAttribute("isbnNumber"); logger.info("ISBN Number of selected book : " + isbnNumber); // --obtain the Book catalog from PortletContext BookDataObject catalog = (BookDataObject) getPortletContext().getAttribute("bookCatalog"); // --get the Book with the same ISBN number Book matchingBook = null; List<Book> books = catalog.getBooks(); for (Book book : books) { if (book.getIsbnNumber().longValue() == Long.valueOf(isbnNumber)) { matchingBook = book; break; } } if (matchingBook != null) { logger.info( "Setting download URL for book with ISBN " + matchingBook.getIsbnNumber() + " to " + request.getParameter("tocDownloadUrl")); matchingBook.setDownloadUrl(request.getParameter("tocDownloadUrl")); } else { response.setRenderParameter("myaction", "error"); response.setRenderParameter( "exceptionMsg", "No matching book with ISBN number " + isbnNumber + " found in the catalog"); } }
/** * Process an action request. * * @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest, * javax.portlet.ActionResponse) */ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, java.io.IOException { if (request.getParameter(FORM_SUBMIT) != null) { // Set form text in the session bean Vlado2PortletSessionBean sessionBean = getSessionBean(request); if (sessionBean != null) sessionBean.setFormText(request.getParameter(FORM_TEXT)); } if (request.getParameter(EDIT_SUBMIT) != null) { PortletPreferences prefs = request.getPreferences(); try { prefs.setValue(EDIT_KEY, request.getParameter(EDIT_TEXT)); prefs.store(); } catch (ReadOnlyException roe) { } catch (ValidatorException ve) { } } if (request.getParameter(CONFIG_SUBMIT) != null) { PortletPreferences prefs = request.getPreferences(); try { prefs.setValue(CONFIG_KEY, request.getParameter(CONFIG_TEXT)); prefs.store(); } catch (ReadOnlyException roe) { } catch (ValidatorException ve) { } } }
public void processAction( PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { if (!Constants.UPDATE.equals(actionRequest.getParameter(Constants.CMD))) { return; } PortletPreferences prefs; String portletResource = ParamUtil.getString(actionRequest, "portletResource"); if (Validator.isNotNull(portletResource)) { prefs = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource); } else { prefs = actionRequest.getPreferences(); } prefs.setValue("showActionSocial", actionRequest.getParameter("showActionSocial")); prefs.setValue("showActionAudit", actionRequest.getParameter("showActionAudit")); prefs.store(); SessionMessages.add(actionRequest, portletConfig.getPortletName() + ".doConfigure"); // SessionMessages.add(actionRequest,"success"); }
public void processActionEdit(ActionRequest request, ActionResponse response) throws PortletException, IOException { // TODO: Check Role // Stay in EDIT mode unless we are successful response.setPortletMode(PortletMode.EDIT); Placement placement = ToolManager.getCurrentPlacement(); // get the site toolConfiguration, if this is part of a site. ToolConfiguration toolConfig = SiteService.findTool(placement.getId()); String id = request.getParameter(LTIService.LTI_ID); String toolId = request.getParameter(LTIService.LTI_TOOL_ID); Properties reqProps = new Properties(); Enumeration names = request.getParameterNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); reqProps.setProperty(name, request.getParameter(name)); } Object retval = m_ltiService.updateContent(Long.parseLong(id), reqProps); placement.save(); response.setPortletMode(PortletMode.VIEW); }
private Map<String, String> getSchedulerProperties( ActionRequest req, ContentImporterForm contentImporterForm) { Map<String, String> properties = new HashMap<String, String>(5); Enumeration<String> propertiesNames = req.getParameterNames(); if (UtilMethods.isSet(contentImporterForm.getMap())) { properties = contentImporterForm.getMap(); } else { String propertyName; String propertyValue; for (; propertiesNames.hasMoreElements(); ) { propertyName = propertiesNames.nextElement(); if (propertyName.startsWith("propertyName")) { propertyValue = req.getParameter("propertyValue" + propertyName.substring(12)); if (UtilMethods.isSet(req.getParameter(propertyName)) && UtilMethods.isSet(propertyValue)) properties.put(req.getParameter(propertyName), propertyValue); } } } return properties; }
@SuppressWarnings("deprecation") private Structure _loadStructure(ActionForm form, ActionRequest req, ActionResponse res) throws ActionException, DotDataException { User user = _getUser(req); Structure structure = new Structure(); String inodeString = req.getParameter("inode"); if (InodeUtils.isSet(inodeString)) { /* * long inode = Long.parseLong(inodeString); if (inode != 0) { * structure = StructureFactory.getStructureByInode(inode); } */ if (InodeUtils.isSet(inodeString)) { structure = StructureFactory.getStructureByInode(inodeString); } } req.setAttribute(WebKeys.Structure.STRUCTURE, structure); boolean searchable = false; List<Field> fields = structure.getFields(); for (Field f : fields) { if (f.isIndexed()) { searchable = true; break; } } if (!searchable && InodeUtils.isSet(structure.getInode())) { String message = "warning.structure.notsearchable"; SessionMessages.add(req, "message", message); } if (structure.isFixed()) { String message = "warning.object.isfixed"; SessionMessages.add(req, "message", message); } // Checking permissions _checkUserPermissions(structure, user, PermissionAPI.PERMISSION_READ); return structure; }
@Override public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { String path = actionRequest.getParameter("struts_action"); if (Validator.isNotNull(path)) { // Call processAction of com.liferay.portal.struts.PortletAction try { PortletRequestProcessor processor = _getPortletRequestProcessor(); processor.process(actionRequest, actionResponse, path); } catch (ServletException se) { throw new PortletException(se); } } if (copyRequestParameters) { PortalUtil.copyRequestParameters(actionRequest, actionResponse); } }