Exemplo n.º 1
0
  public List<Issue> getIssueList() throws IOException {
    List<Issue> issueList = new ArrayList<Issue>();

    IssueService service = new IssueService(client);
    Map<String, String> issueFilter = new HashMap<String, String>();

    if (includeOpenIssues) {
      // Adding open issues

      for (org.eclipse.egit.github.core.Issue issue :
          service.getIssues(githubOwner, githubRepo, issueFilter)) {
        if (!onlyMilestoneIssues || issue.getMilestone() != null) {
          issueList.add(createIssue(issue));
        }
      }
    }

    // Adding closed issues

    issueFilter.put("state", "closed");

    for (org.eclipse.egit.github.core.Issue issue :
        service.getIssues(githubOwner, githubRepo, issueFilter)) {
      if (!onlyMilestoneIssues || issue.getMilestone() != null) {
        issueList.add(createIssue(issue));
      }
    }

    return issueList;
  }
Exemplo n.º 2
0
  @RequestMapping("/output")
  public String func(HttpServletRequest req, HttpServletResponse resp) throws Exception {
    String outputURL = "first";

    try {
      String path = req.getParameter("path");
      // System.out.println(path);
      String arr[] = path.split("/");
      String repoName = arr[arr.length - 1];
      String user = arr[arr.length - 2];
      // System.out.println(user+" - " +path);

      Set<Issue> lessSeven = new LinkedHashSet<Issue>();
      Set<Issue> between24and7 = new LinkedHashSet<Issue>();
      Set<Issue> greaterSeven = new LinkedHashSet<Issue>();

      Date yesterday = new Date(System.currentTimeMillis() - (24 * 60 * 60 * 1000));
      // String yesterdayDate=sdf.format(yesterday);
      Date DaysAgo7Date = new Date(System.currentTimeMillis() - 7 * 24 * 60 * 60 * 1000);
      // String DaysAgo7=sdf.format(DaysAgo7Date);

      GitHubClient git = new GitHubClient();
      // git.setOAuth2Token("39de076299133c5c995ee00b1573f9826887e5bd");
      git.setCredentials("TheMask", "sugandh4");
      RepositoryService repoService = new RepositoryService(git);
      IssueService issueService = new IssueService(git);
      Repository repo = null;
      repo = repoService.getRepository(user, repoName);

      System.out.println(repo.getName());
      System.out.println(repo.getOpenIssues());
      Map<String, String> paramIssue = new HashMap<String, String>();
      paramIssue.put("state", "open");
      // paramIssue.put("sort", "created");
      List<Issue> issueList = issueService.getIssues(repo, paramIssue);
      for (Issue issue : issueList) {
        // System.out.println(issue.getCreatedAt());
        if (issue.getCreatedAt().after(yesterday)) lessSeven.add(issue);
        else if ((issue.getCreatedAt().before(yesterday))
            && (issue.getCreatedAt().after(DaysAgo7Date))) between24and7.add(issue);
        else greaterSeven.add(issue);
      }

      HttpSession session = req.getSession();
      session.setAttribute("firstList", lessSeven);
      session.setAttribute("secondList", between24and7);
      session.setAttribute("thirdList", greaterSeven);
    } catch (Exception e) {
      System.out.println(e.getMessage());
      outputURL = "error";
    }

    System.out.println(outputURL);
    return outputURL;
  }