def BuildTable(self, start_row, end_row, request):
    """Add all the notifications to this table."""
    row_index = 0
    search_term = request.REQ.get("sSearch")

    # We modify this object by changing the notification from pending to
    # shown.
    try:
      user_fd = aff4.FACTORY.Open(aff4.ROOT_URN.Add("users").Add(
          request.user), aff4_type="GRRUser", token=request.token)
    except __HOLE__:
      return

    # Hack for sorting. Requires retrieval of all notifications.
    notifications = list(user_fd.ShowNotifications(reset=False))
    for notification in sorted(notifications, key=lambda x: x.timestamp,
                               reverse=True):
      if row_index < start_row: continue
      if row_index > end_row: break

      if (search_term and
          search_term.lower() not in notification.message.lower()):
        continue

      row = {"Message": notification.message,
             "Target": self.FormatFromTemplate(
                 self.target_template,
                 hash=self.BuildHashFromNotification(notification),
                 notification_type=notification.type,
                 target=notification.subject),
             "Timestamp": rdfvalue.RDFDatetime(notification.timestamp)}
      self.AddRow(row, row_index)
      row_index += 1

    flow.GRRFlow.StartFlow(flow_name="ResetUserNotifications",
                           token=request.token)
dataset/ETHPy150Open google/grr/grr/gui/plugins/notifications.py/ViewNotifications.BuildTable