Exemplo n.º 1
0
  @Override
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

    try {
      ActionUtil.getNode(renderRequest);
      ActionUtil.getPage(renderRequest);

      compareVersions(renderRequest, renderResponse);
    } catch (Exception e) {
      if (e instanceof NoSuchPageException) {
        SessionErrors.add(renderRequest, e.getClass());

        return mapping.findForward("portlet.wiki.error");
      } else {
        throw e;
      }
    }

    return mapping.findForward("portlet.wiki.compare_versions");
  }
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

    try {
      ActionUtil.getNode(renderRequest);
      ActionUtil.getPage(renderRequest);
    } catch (Exception e) {
      if (e instanceof NoSuchNodeException
          || e instanceof NoSuchPageException
          || e instanceof PrincipalException) {

        SessionErrors.add(renderRequest, e.getClass().getName());

        return mapping.findForward("portlet.wiki.error");
      } else {
        throw e;
      }
    }

    return mapping.findForward(getForward(renderRequest, "portlet.wiki.edit_page_attachment"));
  }
Exemplo n.º 3
0
  public static WikiNode getNode(PortletRequest portletRequest) throws Exception {

    HttpServletRequest request = PortalUtil.getHttpServletRequest(portletRequest);

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    long nodeId = ParamUtil.getLong(request, "nodeId");
    String nodeName = ParamUtil.getString(request, "nodeName");

    WikiNode node = null;

    try {
      if (nodeId > 0) {
        node = WikiNodeServiceUtil.getNode(nodeId);
      } else if (Validator.isNotNull(nodeName)) {
        node = WikiNodeServiceUtil.getNode(themeDisplay.getScopeGroupId(), nodeName);
      } else {
        throw new NoSuchNodeException();
      }
    } catch (NoSuchNodeException nsne) {
      node = ActionUtil.getFirstVisibleNode(portletRequest);
    }

    request.setAttribute(WebKeys.WIKI_NODE, node);

    return node;
  }