示例#1
0
  @Override
  protected Collection<AnnouncementBoard> boardsToView(HttpServletRequest request)
      throws Exception {
    Unit unit = getUnit(request);
    List<AnnouncementBoard> boards = new ArrayList<AnnouncementBoard>();

    if (unit == null) {
      return boards;
    }

    User userView = getUserView(request);
    for (AnnouncementBoard board : unit.getBoardsSet()) {
      if (board.getReaders() == null) {
        boards.add(board);
      }

      if (board.getReaders().isMember(userView)) {
        boards.add(board);
      }
    }

    return boards;
  }
示例#2
0
  @Override
  protected AnnouncementBoard getRequestedAnnouncementBoard(HttpServletRequest request) {
    Unit unit = getUnit(request);

    if (unit == null) {
      return null;
    } else {
      MultiLanguageString name = getBoardName(request);
      for (AnnouncementBoard board : unit.getBoardsSet()) {
        if (board.getReaders() == null && board.getName().equalInAnyLanguage(name)) {
          return board;
        }
      }

      return null;
    }
  }