Пример #1
0
 private static void buildPostingHistory(
     String userName, Project project, List<Posting> postings, List<History> histories) {
   for (Posting posting : postings) {
     History postingHistory = new History();
     String authorName = posting.authorName;
     postingHistory.setWho(authorName);
     setUserPageUrl(postingHistory, User.findByLoginId(posting.authorLoginId));
     postingHistory.setWhen(posting.createdDate);
     postingHistory.setWhere(project.name);
     postingHistory.setWhat("post");
     postingHistory.setShortTitle("#" + posting.number);
     postingHistory.setHow(posting.title);
     postingHistory.setUrl("/" + userName + "/" + project.name + "/post/" + posting.number);
     histories.add(postingHistory);
   }
 }
Пример #2
0
 private static void buildIssueHistory(
     String userName, Project project, List<Issue> issues, List<History> histories) {
   for (Issue issue : issues) {
     History issueHistory = new History();
     String authorName = issue.authorName;
     issueHistory.setWho(authorName);
     setUserPageUrl(issueHistory, User.findByLoginId(issue.authorLoginId));
     issueHistory.setWhen(issue.createdDate);
     issueHistory.setWhere(project.name);
     issueHistory.setWhat("issue");
     issueHistory.setShortTitle("#" + issue.number);
     issueHistory.setHow(issue.title);
     issueHistory.setUrl("/" + userName + "/" + project.name + "/issue/" + issue.number);
     histories.add(issueHistory);
   }
 }
Пример #3
0
 private static void buildPullRequestsHistory(
     String userName, Project project, List<PullRequest> pullRequests, List<History> histories) {
   for (PullRequest pull : pullRequests) {
     History pullHistory = new History();
     User contributor = pull.contributor;
     pullHistory.setWho(contributor.loginId);
     setUserPageUrl(pullHistory, User.findByLoginId(contributor.loginId));
     pullHistory.setWhen(pull.created);
     pullHistory.setWhere(project.name);
     pullHistory.setWhat("pullrequest");
     pullHistory.setShortTitle("#" + pull.number);
     pullHistory.setHow(pull.title);
     pullHistory.setUrl("/" + userName + "/" + project.name + "/pullRequest/" + pull.number);
     histories.add(pullHistory);
   }
 }
Пример #4
0
 private static void buildCommitHistory(
     String userName, Project project, List<Commit> commits, List<History> histories) {
   if (commits != null) {
     for (Commit commit : commits) {
       History commitHistory = new History();
       String authorEmail = commit.getAuthorEmail();
       if (User.isEmailExist(authorEmail)) {
         setUserPageUrl(commitHistory, User.findByEmail(authorEmail));
       } else {
         commitHistory.setWho(commit.getAuthorName());
       }
       commitHistory.setWhen(commit.getCommitterDate());
       commitHistory.setWhere(project.name);
       commitHistory.setWhat("commit");
       commitHistory.setShortTitle(commit.getShortId());
       commitHistory.setHow(commit.getShortMessage());
       commitHistory.setUrl("/" + userName + "/" + project.name + "/commit/" + commit.getId());
       histories.add(commitHistory);
     }
   }
 }