Package br.edu.utfpr.cm.JGitMinerWeb.model.miner

Examples of br.edu.utfpr.cm.JGitMinerWeb.model.miner.EntityPullRequest


        int count = 1;
        for (EntityIssue issue : issuesCommenteds) {
            out.printLog("##################### NR: " + issue.getNumber() + " URL: " + issue.getUrl());
            out.printLog(count + " of the " + issuesCommenteds.size());

            EntityPullRequest pr = dao.selectOneWithParams(selectPullRequests,
                    selectPullRequestsParams,
                    new Object[]{getRepository(), issue});

            if (pr.getRepositoryCommits().isEmpty()) {
                continue;
            }

            out.printLog(pr.getRepositoryCommits().size() + " commits in pull request ");

            List<EntityCommitFile> commitFiles = new ArrayList<>();
            for (EntityRepositoryCommit comm : pr.getRepositoryCommits()) {
                if (comm.getFiles().size() <= getMaxFilesPerCommit()) {
                    commitFiles.addAll(comm.getFiles());
                }
            }
View Full Code Here


                minerEventsIssue(issue, gitRepo);
            }
            if (minerCommentsOfIssues && issue.getCommentsCount() > issue.getComments().size()) {
                minerCommentsOfIssue(issue, gitRepo);
            }
            EntityPullRequest pull = PullRequestServices.getPullRequestByNumber(gitIssue.getNumber(), repository, dao);
            if (pull != null) {
                pull.setIssue(issue);
                issue.setPullRequest(pull);
                dao.edit(pull);
            }
            repository.addIssue(issue);
            dao.edit(issue);
View Full Code Here

        EntityRepository repository = dao.findByID(repositoryToMinerId, EntityRepository.class);
        int i = 0;
        calculeSubProgress(i, gitPullRequests.size());
        while (!canceled && i < gitPullRequests.size()) {
            PullRequest gitPull = gitPullRequests.get(i);
            EntityPullRequest pullRequest = minerPullRequest(gitPull);
            if (pullRequest.getIssue() == null) {
                EntityIssue issue = IssueServices.getIssueByNumber(gitPull.getNumber(), repository, dao);
                if (issue != null) {
                    issue.setPullRequest(pullRequest);
                    pullRequest.setIssue(issue);
                }
            }
            if (pullRequest.getRepositoryCommits().isEmpty()) {
                out.printLog("Baixando commits do Pull Request...");
                List<RepositoryCommit> gitRepoCommits = RepositoryCommitServices.getGitRepoCommitsFromPullRequest(pullRequest, repository);
                minerRepositoryCommits(gitRepoCommits, gitRepo, pullRequest);
                out.printLog(pullRequest.getRepositoryCommits().size() + " commits baixados do Pull Request...");
            }
            pullRequest.setRepository(repository);
            dao.edit(pullRequest);
            i++;
            calculeSubProgress(i, gitPullRequests.size());
        }
    }
View Full Code Here

            calculeSubProgress(i, gitPullRequests.size());
        }
    }

    private EntityPullRequest minerPullRequest(PullRequest gitPull) {
        EntityPullRequest pull = null;
        try {
            pull = PullRequestServices.createEntity(gitPull, dao);
            out.printLog("PullRequest gravado com sucesso: " + gitPull.getTitle() + " - ID: " + gitPull.getId());
        } catch (Exception ex) {
            ex.printStackTrace();
View Full Code Here

            String jpql = "SELECT p "
                    + " FROM EntityPullRequest p "
                    + " WHERE p.repository = :repo "
                    + " AND p.issue = :issue ";

            EntityPullRequest pr = dao.selectOneWithParams(jpql,
                    new String[]{"repo", "issue"},
                    new Object[]{getRepository(), issue});

            if (pr.getRepositoryCommits().isEmpty()) {
                continue;
            }

            out.printLog(pr.getRepositoryCommits().size() + " commits in pull request ");

            List<EntityCommitFile> commitFiles = new ArrayList();
            for (EntityRepositoryCommit comm : pr.getRepositoryCommits()) {
                if (comm.getFiles().size() <= getMaxFilesPerCommit()) {
                    commitFiles.addAll(comm.getFiles());
                }
            }
View Full Code Here

        for (EntityIssue issue : issuesCommenteds) {
            out.printLog("##################### NR: " + issue.getNumber() + " URL: " + issue.getUrl());
            out.printLog(count + " of the " + issuesCommenteds.size());

            EntityPullRequest pr = dao.selectOneWithParams(selectPullRequests,
                    selectPullRequestsParams,
                    new Object[]{getRepository(), beginDate, endDate, issue});

            out.printLog("Pull Request #" + pr.getId());
            if (pr.getRepositoryCommits().isEmpty()) {
                out.printLog("No Commits in Pull Request");
                count++;
                continue;
            }

            out.printLog(pr.getRepositoryCommits().size() + " commits in pull request ");

            List<EntityCommitFile> commitFiles = new ArrayList<>();
            for (EntityRepositoryCommit comm : pr.getRepositoryCommits()) {
                if (comm.getFiles().size() <= getMaxFilesPerCommit()) {
                    for (EntityCommitFile entityCommitFile : comm.getFiles()) {
                        long countPullRequestIn = fileDAO.calculeNumberOfPullRequestWhereFileIsIn(
                                getRepository(), entityCommitFile.getFilename(),
                                beginDate, endDate, 0, getMaxFilesPerCommit(), isOnlyMerged());
View Full Code Here

    public static EntityPullRequest createEntity(PullRequest gitPullRequest, GenericDao dao) {
        if (gitPullRequest == null) {
            return null;
        }

        EntityPullRequest pull = getPullRequestByIdPull(gitPullRequest.getId(), dao);

        if (pull == null) {
            pull = new EntityPullRequest();
        }

        pull.setMineredAt(new Date());
        pull.setMergeable(gitPullRequest.isMergeable());
        pull.setMerged(gitPullRequest.isMerged());
        pull.setClosedAt(gitPullRequest.getClosedAt());
        pull.setMergedAt(gitPullRequest.getMergedAt());
        pull.setUpdatedAt(gitPullRequest.getUpdatedAt());
        pull.setCreatedAt(gitPullRequest.getCreatedAt());
        pull.setIdPullRequest(gitPullRequest.getId());
        pull.setAdditions(gitPullRequest.getAdditions());
        pull.setChangedFiles(gitPullRequest.getChangedFiles());
        pull.setCommentsCount(gitPullRequest.getComments());
        pull.setCommitsCount(gitPullRequest.getCommits());
        pull.setDeletions(gitPullRequest.getDeletions());
        pull.setNumber(gitPullRequest.getNumber());
        if (pull.getBase() == null) {
            pull.setBase(PullRequestMakerServices.createEntity(gitPullRequest.getBase(), dao));
        }
        if (pull.getHead() == null) {
            pull.setHead(PullRequestMakerServices.createEntity(gitPullRequest.getHead(), dao));
        }
        pull.setBody(gitPullRequest.getBody());
        pull.setBodyHtml(gitPullRequest.getBodyHtml());
        pull.setBodyText(gitPullRequest.getBodyText());
        pull.setDiffUrl(gitPullRequest.getDiffUrl());
        pull.setHtmlUrl(gitPullRequest.getHtmlUrl());
        pull.setIssueUrl(gitPullRequest.getIssueUrl());
        pull.setPatchUrl(gitPullRequest.getPatchUrl());
        pull.setStatePullRequest(gitPullRequest.getState());
        pull.setTitle(gitPullRequest.getTitle());
        pull.setUrl(gitPullRequest.getUrl());
        pull.setMergedBy(UserServices.createEntity(gitPullRequest.getMergedBy(), dao, false));
        pull.setUser(UserServices.createEntity(gitPullRequest.getUser(), dao, false));

        if (pull.getId() == null || pull.getId().equals(0l)) {
            dao.insert(pull);
        } else {
            dao.edit(pull);
        }
View Full Code Here

TOP

Related Classes of br.edu.utfpr.cm.JGitMinerWeb.model.miner.EntityPullRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.