コード例 #1
0
ファイル: TurboIssue.java プロジェクト: jinified/HubTurbo
  public TurboIssue(String repoId, Issue issue) {
    this.id = issue.getNumber();
    this.title = issue.getTitle() == null ? "" : issue.getTitle();
    this.creator = issue.getUser().getLogin();
    this.createdAt = Utility.dateToLocalDateTime(issue.getCreatedAt());
    this.isPullRequest = isPullRequest(issue);

    this.description = issue.getBody() == null ? "" : issue.getBody();
    this.updatedAt =
        issue.getUpdatedAt() != null
            ? Utility.dateToLocalDateTime(issue.getUpdatedAt())
            : this.createdAt;
    this.commentCount = issue.getComments();
    this.isOpen = issue.getState().equals(STATE_OPEN);
    this.assignee =
        issue.getAssignee() == null
            ? Optional.empty()
            : Optional.of(issue.getAssignee().getLogin());
    this.labels = issue.getLabels().stream().map(Label::getName).collect(Collectors.toList());
    this.milestone =
        issue.getMilestone() == null
            ? Optional.empty()
            : Optional.of(issue.getMilestone().getNumber());

    this.metadata = IssueMetadata.empty();
    this.repoId = repoId;
    this.markedReadAt = Optional.empty();
  }
コード例 #2
0
  protected Issue createIssue(org.eclipse.egit.github.core.Issue githubIssue) {
    Issue issue = new Issue();

    issue.setKey(String.valueOf(githubIssue.getNumber()));
    issue.setId(String.valueOf(githubIssue.getNumber()));

    issue.setLink(this.githubIssueURL + githubIssue.getNumber());

    issue.setCreated(githubIssue.getCreatedAt());

    issue.setUpdated(githubIssue.getUpdatedAt());

    if (githubIssue.getAssignee() != null) {
      if (githubIssue.getAssignee().getName() != null) {
        issue.setAssignee(githubIssue.getAssignee().getName());
      } else {
        issue.setAssignee(githubIssue.getAssignee().getLogin());
      }
    }

    issue.setTitle(githubIssue.getTitle());

    issue.setSummary(githubIssue.getTitle());

    if (githubIssue.getMilestone() != null) {
      issue.addFixVersion(githubIssue.getMilestone().getTitle());
    }

    issue.setReporter(githubIssue.getUser().getLogin());

    if (githubIssue.getClosedAt() != null) {
      issue.setStatus("closed");
    } else {
      issue.setStatus("open");
    }

    List<Label> labels = githubIssue.getLabels();
    if (labels != null && !labels.isEmpty()) {
      issue.setType(labels.get(0).getName());
    }

    return issue;
  }