protected void processTab(ActionResponse actionResponse, String tab)
     throws PortletException, IOException {
   if (tab.equals(PARAMV_TAB_GEOTHESAURUS)) {
     actionResponse.sendRedirect(actionResponse.encodeURL(PAGE_GEOTHESAURUS));
   } else if (tab.equals(PARAMV_TAB_MAP)) {
     actionResponse.sendRedirect(actionResponse.encodeURL(PAGE_MAP));
   } else {
     super.processTab(actionResponse, tab);
   }
 }
 @SuppressWarnings("unchecked")
 @ProcessAction(name = "addBookAction")
 public void addBook(ActionRequest request, ActionResponse response)
     throws PortletException, IOException {
   logger.info("addBook action invoked");
   if (!request.isUserInRole("administrator")) {
     response.setRenderParameter("myaction", "error");
     response.setRenderParameter(
         "exceptionMsg",
         "You are not authorized for this action. You must have Administrator role.");
     return;
   }
   request.setAttribute("myaction", "addBookAction");
   PortletRequestDispatcher dispatcher =
       request
           .getPortletSession()
           .getPortletContext()
           .getRequestDispatcher(response.encodeURL("/myservlet/bookServlet"));
   dispatcher.include(request, response);
   Map<String, String> map = (Map<String, String>) request.getAttribute("errors");
   if (map != null && !map.isEmpty()) {
     response.setRenderParameter("myaction", "addBookAction");
   } else {
     response.setRenderParameter("myaction", "showCatalog");
   }
 }
  @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"));
  }
 @ProcessAction(name = "removeBookAction")
 public void removeBook(ActionRequest request, ActionResponse response)
     throws PortletException, IOException {
   logger.info("Inside removeBook 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;
   }
   request.setAttribute("myaction", "removeBookAction");
   PortletRequestDispatcher dispatcher =
       request
           .getPortletSession()
           .getPortletContext()
           .getRequestDispatcher(response.encodeURL("/myservlet/bookServlet"));
   dispatcher.include(request, response);
   response.setRenderParameter("myaction", "showCatalog");
 }
Ejemplo n.º 5
0
 protected void processTab(ActionResponse actionResponse, String tab)
     throws PortletException, IOException {
   if (tab.equals(PARAMV_TAB_TOPIC)) {
     actionResponse.sendRedirect(actionResponse.encodeURL(PAGE_TOPIC));
   } else if (tab.equals(PARAMV_TAB_PLACE)) {
     actionResponse.sendRedirect(actionResponse.encodeURL(PAGE_PLACE));
   } else if (tab.equals(PARAMV_TAB_TIME)) {
     actionResponse.sendRedirect(actionResponse.encodeURL(PAGE_TIME));
   } else if (tab.equals(PARAMV_TAB_AREA)) {
     if (PortalConfig.getInstance()
         .getBoolean("portal.enable.search.ext.env.area.contents", true)) {
       actionResponse.sendRedirect(actionResponse.encodeURL(PAGE_AREA_CONTENTS));
     } else if (PortalConfig.getInstance()
         .getBoolean("portal.enable.search.ext.env.area.sources", true)) {
       actionResponse.sendRedirect(actionResponse.encodeURL(PAGE_AREA_SOURCES));
     } else if (PortalConfig.getInstance()
         .getBoolean("portal.enable.search.ext.env.area.partner", true)) {
       actionResponse.sendRedirect(actionResponse.encodeURL(PAGE_AREA_PARTNER));
     }
   }
 }