private static void insertTestData() {
    YamlUtil.insertDataFromYaml(
        "test-data.yml",
        new String[] {
          "users",
          "projects",
          "pullRequests",
          "milestones",
          "issues",
          "issueComments",
          "postings",
          "postingComments",
          "projectUsers",
          "organization",
          "organizationUsers"
        });
    // Do numbering for issues and postings.
    for (Project project : Project.find.findList()) {
      List<Issue> issues =
          Issue.finder.where().eq("project.id", project.id).orderBy("id desc").findList();

      for (Issue issue : issues) {
        issue.save();
      }

      List<Posting> postings =
          Posting.finder.where().eq("project.id", project.id).orderBy("id desc").findList();

      for (Posting posting : postings) {
        posting.save();
      }
    }
  }
示例#2
0
文件: UserApp.java 项目: bluemir/hive
 private static void collectDatum(
     List<Project> projects,
     List<Posting> postings,
     List<Issue> issues,
     List<PullRequest> pullRequests,
     List<Milestone> milestones,
     int daysAgo) {
   // collect all postings, issues, pullrequests and milesotnes that are contained in the projects.
   for (Project project : projects) {
     if (AccessControl.isAllowed(UserApp.currentUser(), project.asResource(), Operation.READ)) {
       postings.addAll(Posting.findRecentlyCreatedByDaysAgo(project, daysAgo));
       issues.addAll(Issue.findRecentlyOpendIssuesByDaysAgo(project, daysAgo));
       pullRequests.addAll(PullRequest.findOpendPullRequestsByDaysAgo(project, daysAgo));
       milestones.addAll(Milestone.findOpenMilestones(project.id));
     }
   }
 }