コード例 #1
0
  @Override
  protected List<Message> getMessagesFrom(Level level) {
    List<Level> levels = new LinkedList<Level>();

    for (Level iter : Level.values()) {
      if (iter.compareTo(level) == 0) {
        levels.add(iter);
      } else {
        break;
      }
    }

    return getMessages(jobId, 0, levels);
  }
コード例 #2
0
  protected class MessageFilter implements MessageAccessor.MessageFilter {
    List<Level> mLevels = Arrays.asList(Level.values());
    int mSeq = -1;
    int mStart;
    int mEnd;
    boolean getRange = false;

    @Override
    public MessageFilter filterLevels(final Set<Level> levels) {
      mLevels = new LinkedList<Level>(levels);
      return this;
    }

    @Override
    public MessageFilter greaterThan(int idx) {
      mSeq = idx;
      return this;
    }

    @Override
    public MessageFilter inRange(int start, int end) {
      mStart = start;
      mEnd = end;
      getRange = true;
      return this;
    }

    @Override
    public List<Message> getMessages() {
      if (getRange) {
        return PersistentMessageAccessor.this.getMessagesInRange(jobId, mStart, mEnd, mLevels);
      } else {
        return PersistentMessageAccessor.this.getMessages(jobId, mSeq, mLevels);
      }
    }
  }
コード例 #3
0
 @Override
 public List<Message> getAll() {
   return getMessages(jobId, 0, Arrays.asList(Level.values()));
 }