private boolean isBuildTarget(Pullrequest pullRequest) {
    if (pullRequest.getState() != null && pullRequest.getState().equals("OPEN")) {
      if (isSkipBuild(pullRequest.getTitle()) || !isFilteredBuild(pullRequest)) {
        return false;
      }

      Pullrequest.Revision source = pullRequest.getSource();
      String sourceCommit = source.getCommit().getHash();
      Pullrequest.Revision destination = pullRequest.getDestination();
      String owner = destination.getRepository().getOwnerName();
      String repositoryName = destination.getRepository().getRepositoryName();

      Pullrequest.Repository sourceRepository = source.getRepository();
      String buildKeyPart = this.builder.getProjectId();

      final boolean commitAlreadyBeenProcessed =
          this.client.hasBuildStatus(
              sourceRepository.getOwnerName(),
              sourceRepository.getRepositoryName(),
              sourceCommit,
              buildKeyPart);
      if (commitAlreadyBeenProcessed)
        logger.log(
            Level.INFO,
            "Commit {0}#{1} has already been processed",
            new Object[] {sourceCommit, buildKeyPart});

      final String id = pullRequest.getId();
      List<Pullrequest.Comment> comments = client.getPullRequestComments(owner, repositoryName, id);

      boolean rebuildCommentAvailable = false;
      if (comments != null) {
        Collection<Pullrequest.Comment> filteredComments = this.filterPullRequestComments(comments);
        for (Pullrequest.Comment comment : filteredComments) {
          String content = comment.getContent();
          if (this.isTTPComment(content)) {
            rebuildCommentAvailable = true;
            logger.log(
                Level.INFO,
                "Rebuild comment available for commit {0} and comment #{1}",
                new Object[] {sourceCommit, comment.getId()});
          }
          rebuildCommentAvailable &= this.processTTPCommentBuildTags(content, buildKeyPart);
          if (!rebuildCommentAvailable) break;
        }
      }
      if (rebuildCommentAvailable)
        this.postBuildTagInTTPComment(id, "TTP build flag", buildKeyPart);

      final boolean canBuildTarget = rebuildCommentAvailable || !commitAlreadyBeenProcessed;
      logger.log(
          Level.INFO,
          "Build target? {0} [rebuild:{1} processed:{2}]",
          new Object[] {canBuildTarget, rebuildCommentAvailable, commitAlreadyBeenProcessed});
      return canBuildTarget;
    }

    return false;
  }
 public List<Pullrequest.Comment> filterPullRequestComments(List<Pullrequest.Comment> comments) {
   logger.info("Filter PullRequest Comments.");
   Collections.sort(comments);
   Collections.reverse(comments);
   List<Pullrequest.Comment> filteredComments = new LinkedList<Pullrequest.Comment>();
   for (Pullrequest.Comment comment : comments) {
     String content = comment.getContent();
     if (content == null || content.isEmpty()) continue;
     boolean isTTP = this.isTTPComment(content);
     boolean isTTPBuild = this.isTTPCommentBuildTags(content);
     if (isTTP || isTTPBuild) filteredComments.add(comment);
     if (isTTP) break;
   }
   return filteredComments;
 }