@Override
  protected void validateImportedStagedModel(
      StagedModel stagedModel, StagedModel importedStagedModel) throws Exception {

    super.validateImportedStagedModel(stagedModel, importedStagedModel);

    MBCategory category = (MBCategory) stagedModel;
    MBCategory importedCategory = (MBCategory) importedStagedModel;

    Assert.assertEquals(category.getName(), importedCategory.getName());
    Assert.assertEquals(category.getDescription(), importedCategory.getDescription());
    Assert.assertEquals(category.getDisplayStyle(), importedCategory.getDisplayStyle());
    Assert.assertEquals(category.getThreadCount(), importedCategory.getThreadCount());
    Assert.assertEquals(category.getMessageCount(), importedCategory.getMessageCount());
    Assert.assertEquals(category.getLastPostDate(), importedCategory.getLastPostDate());
  }
コード例 #2
0
  public static void addPortletBreadcrumbEntries(
      MBCategory category, HttpServletRequest request, RenderResponse renderResponse)
      throws Exception {

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

    String mvcRenderCommandName = ParamUtil.getString(request, "mvcRenderCommandName");

    PortletURL portletURL = renderResponse.createRenderURL();

    if (mvcRenderCommandName.equals("/message_boards/select_category")) {
      portletURL.setParameter("mvcRenderCommandName", "/message_boards/select_category");
      portletURL.setWindowState(LiferayWindowState.POP_UP);

      PortalUtil.addPortletBreadcrumbEntry(
          request, themeDisplay.translate("categories"), portletURL.toString());
    } else {
      portletURL.setParameter("mvcRenderCommandName", "/message_boards/view");
    }

    PortalUtil.addPortletBreadcrumbEntry(
        request, themeDisplay.translate("home"), portletURL.toString());

    if (category == null) {
      return;
    }

    if (!mvcRenderCommandName.equals("/message_boards/select_category")) {
      portletURL.setParameter("mvcRenderCommandName", "/message_boards/view_category");
    }

    List<MBCategory> ancestorCategories = category.getAncestors();

    Collections.reverse(ancestorCategories);

    for (MBCategory curCategory : ancestorCategories) {
      portletURL.setParameter("mbCategoryId", String.valueOf(curCategory.getCategoryId()));

      PortalUtil.addPortletBreadcrumbEntry(request, curCategory.getName(), portletURL.toString());
    }

    portletURL.setParameter("mbCategoryId", String.valueOf(category.getCategoryId()));

    PortalUtil.addPortletBreadcrumbEntry(request, category.getName(), portletURL.toString());
  }