private void _doPreparePortlet(HttpServletRequest request, Portlet portlet) throws Exception {

    User user = PortalUtil.getUser(request);
    Layout layout = (Layout) request.getAttribute(WebKeys.LAYOUT);

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

    long scopeGroupId = PortalUtil.getScopeGroupId(request, portlet.getPortletId());

    themeDisplay.setScopeGroupId(scopeGroupId);

    long siteGroupId = 0;

    if (layout.isTypeControlPanel()) {
      siteGroupId = PortalUtil.getSiteGroupId(scopeGroupId);
    } else {
      siteGroupId = PortalUtil.getSiteGroupId(layout.getGroupId());
    }

    themeDisplay.setSiteGroupId(siteGroupId);

    if (user != null) {
      HttpSession session = request.getSession();

      InvokerPortletImpl.clearResponse(
          session,
          layout.getPrimaryKey(),
          portlet.getPortletId(),
          LanguageUtil.getLanguageId(request));
    }

    processPublicRenderParameters(request, layout, portlet);

    if (themeDisplay.isLifecycleRender() || themeDisplay.isLifecycleResource()) {

      WindowState windowState =
          WindowStateFactory.getWindowState(ParamUtil.getString(request, "p_p_state"));

      if (layout.isTypeControlPanel()
          && ((windowState == null)
              || windowState.equals(WindowState.NORMAL)
              || Validator.isNull(windowState.toString()))) {

        windowState = WindowState.MAXIMIZED;
      }

      PortletMode portletMode =
          PortletModeFactory.getPortletMode(ParamUtil.getString(request, "p_p_mode"));

      PortalUtil.updateWindowState(portlet.getPortletId(), user, layout, windowState, request);

      PortalUtil.updatePortletMode(portlet.getPortletId(), user, layout, portletMode, request);
    }
  }
  protected ThemeDisplay getThemeDisplay(Group group) throws Exception {
    ThemeDisplay themeDisplay = new ThemeDisplay();

    Company company = CompanyLocalServiceUtil.getCompany(TestPropsValues.getCompanyId());

    themeDisplay.setCompany(company);

    themeDisplay.setLayoutSet(group.getPublicLayoutSet());
    themeDisplay.setServerPort(80);
    themeDisplay.setSiteGroupId(group.getGroupId());

    return themeDisplay;
  }
예제 #3
0
 /** @deprecated As of 6.2 renamed to {@link #setSiteGroupId(long)} */
 public void setParentGroupId(long parentGroupId) {
   setSiteGroupId(parentGroupId);
 }