コード例 #1
0
  /**
   * Default method runs when displaying portal pages.
   *
   * @return the view to display
   */
  public String doDefault() {
    // Figure out which Tab (view) to show the user.
    String tab;
    if (StringUtils.isNotBlank(view)) {
      // the user has clicked on a particular tab - we show this one.
      tab = view;

    } else {
      // the user did not click on a particular tab.
      // Find which one they clicked on last.
      tab = getTabFromSession();
    }

    if (contentOnly && !isValid(tab)) {
      ServletActionContext.getResponse().setStatus(401);
      return NONE;
    }

    if (!contentOnly) {
      webResourceManager.requireResource("jira.webresources:managedashboards");
    }

    if (Tab.SEARCH.equalsIgnoreCase(tab)) {
      showSearchTab();
    } else if (Tab.POPULAR.equalsIgnoreCase(tab)) {
      showPopularTab();
    } else if (Tab.MY.equalsIgnoreCase(tab)) {
      // We attempt to show the "My" tab, although if it is empty, we may show another one instead.
      showMyTab();
    } else if (Tab.FAVOURITES.equalsIgnoreCase(tab)) {
      // We attempt to show the "FAVOURITES" tab, although if it is empty, we may show another one
      // instead.
      showFavouritesTab();
    } else {
      if (getLoggedInUser() == null) {
        showPopularTab();
      } else {
        showFavouritesTab();
      }
    }
    // remember the current tab, in case we need to know which one to show next time.
    storeTabInSession(view);

    return contentOnly ? CONTENTONLY : SUCCESS;
  }
コード例 #2
0
 private boolean isValid(String tab) {
   return getLoggedInUser() != null || Tab.MY.equals(tab) || Tab.FAVOURITES.equals(tab);
 }