Пример #1
0
  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
  private void mutableFieldDefaults() {
    this.title = "";
    this.description = "";
    this.updatedAt = replaceNull(this.createdAt, LocalDateTime.now());
    this.commentCount = 0;
    this.isOpen = true;
    this.assignee = Optional.empty();
    this.labels = new ArrayList<>();
    this.milestone = Optional.empty();

    this.metadata = IssueMetadata.empty();
    this.markedReadAt = Optional.empty();
  }
Пример #3
0
  public TurboIssue(String repoId, SerializableIssue issue) {
    this.id = issue.getId();
    this.creator = issue.getCreator();
    this.createdAt = issue.getCreatedAt();
    this.isPullRequest = issue.isPullRequest();

    this.title = issue.getTitle();
    this.description = issue.getDescription();
    this.updatedAt = replaceNull(issue.getUpdatedAt(), this.createdAt);
    this.commentCount = issue.getCommentCount();
    this.isOpen = issue.isOpen();
    this.assignee = issue.getAssignee();
    this.labels = issue.getLabels();
    this.milestone = issue.getMilestone();

    this.metadata = IssueMetadata.empty();
    this.repoId = repoId;
    this.markedReadAt = Optional.empty();
  }