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

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


        initialized = true;
        canceled = false;
        fail = false;
        progress = 0;
        subProgress = 0;
        final EntityMiner mineration = new EntityMiner();

        final EntityRepository repositoryToMiner = dao.findByID(repositoryToMinerId, EntityRepository.class);

        out.printLog("Repositorio: " + repositoryToMiner);
        out.printLog("minerOpenIssues: " + minerOpenIssues);
        out.printLog("minerClosedIssues: " + minerClosedIssues);
        out.printLog("\tminerComments: " + minerCommentsOfIssues);
        out.printLog("\tminerEventsOfIssues: " + minerEventsOfIssues);
        out.printLog("minerRepositoryCommits: " + minerRepositoryCommits);
        out.printLog("\tminerCommentsOfRepositoryCommits: " + minerCommentsOfRepositoryCommits);
        out.printLog("\tminerStatsAndFilesOfCommits: " + minerStatsAndFilesOfCommits);
        out.printLog("minerOpenPullRequests: " + minerOpenPullRequests);
        out.printLog("minerClosedPullRequests: " + minerClosedPullRequests);
        out.printLog("minerOpenMilestones: " + minerOpenMilestones);
        out.printLog("minerClosedMilestones: " + minerClosedMilestones);
        out.printLog("minerCollaborators: " + minerCollaborators);
        out.printLog("minerWatchers: " + minerWatchers);
        out.printLog("minerForks: " + minerForks);
        out.printLog("minerTeams: " + minerTeams);

        if (repositoryToMiner == null) {
            message = "Erro: Escolha o repositorio desejado.";
            out.printLog(message);
            progress = 0;
            subProgress = 0;
            initialized = false;
            fail = true;
        } else {
            mineration.setRepository(repositoryToMiner);
            dao.insert(mineration);

            process = new Thread() {
                @Override
                public void run() {

                    out.printLog("########### PROCESSO DE MINERAÇÃO INICIADO! ##############\n");

                    try {
                        Repository gitRepo = RepositoryServices.getGitRepository(repositoryToMiner.getOwner().getLogin(), repositoryToMiner.getName());
                        progress = 10;
                        if (!canceled && (minerOpenIssues || minerClosedIssues)) {
                            subProgress = 0;
                            out.setCurrentProcess("Minerando issues...\n");
                            List<Issue> gitIssues = IssueServices.getGitIssuesFromRepository(gitRepo, minerOpenIssues, minerClosedIssues, out);
                            minerIssues(gitIssues, gitRepo);
                            mineration.setLog(out.getLog().toString());
                            dao.edit(mineration);
                        }
                        progress = 22;
                        if (!canceled && minerRepositoryCommits) {
                            subProgress = 0;
                            out.setCurrentProcess("Minerando RepositoryCommits...\n");
                            List<RepositoryCommit> gitRepoCommits = RepositoryCommitServices.getGitCommitsFromRepository(gitRepo, out);
                            minerRepositoryCommits(gitRepoCommits, gitRepo, null);
                            dao.edit(mineration);
                        }
                        progress = 33;
                        if (!canceled && (minerClosedPullRequests || minerOpenPullRequests)) {
                            subProgress = 0;
                            out.setCurrentProcess("Minerando Pull Requests...\n");
                            List<PullRequest> gitPullRequests = PullRequestServices.getGitPullRequestsFromRepository(gitRepo, minerOpenPullRequests, minerClosedPullRequests, out);
                            minerPullRequests(gitPullRequests, gitRepo);
                            dao.edit(mineration);
                        }
                        progress = 44;
                        if (!canceled && (minerOpenMilestones || minerClosedMilestones)) {
                            subProgress = 0;
                            out.setCurrentProcess("Minerando milestones...\n");
                            List<Milestone> gitMilestones = MilestoneServices.getGitMilestoneFromRepository(gitRepo, minerOpenMilestones, minerClosedMilestones, out);
                            minerMilestones(gitMilestones);
                            mineration.setLog(out.getLog().toString());
                            dao.edit(mineration);
                        }
                        progress = 55;
                        if (!canceled && minerCollaborators) {
                            subProgress = 0;
                            out.setCurrentProcess("Minerando collaborators...\n");
                            List<User> collaborators = UserServices.getGitCollaboratorsFromRepository(gitRepo, out);
                            minerCollaborators(collaborators);
                            mineration.setLog(out.getLog().toString());
                            dao.edit(mineration);
                        }
                        progress = 66;
                        if (!canceled && minerWatchers) {
                            subProgress = 0;
                            out.setCurrentProcess("Minerando watchers...\n");
                            List<User> wacthers = UserServices.getGitWatchersFromRepository(gitRepo, out);
                            minerWatchers(wacthers);
                            mineration.setLog(out.getLog().toString());
                            dao.edit(mineration);
                        }
                        progress = 77;
                        if (!canceled && minerForks) {
                            subProgress = 0;
                            out.setCurrentProcess("Minerando Forks...\n");
                            List<Repository> gitForks = RepositoryServices.getGitForksFromRepository(gitRepo, out);
                            minerForks(gitForks);
                            dao.edit(mineration);
                        }
                        progress = 88;
                        if (!canceled && minerTeams) {
                            subProgress = 0;
                            out.setCurrentProcess("Minerando Teams...\n");
                            List<Team> gitTeams = TeamServices.getGitTeamsFromRepository(gitRepo, out);
                            minerTeams(gitTeams);
                            dao.edit(mineration);
                        }
                        progress = 99;
                        if (canceled) {
                            out.printLog("Processo de mineração cancelado pelo usuário.\n");
                        }
                        mineration.setComplete(true);
                        message = "Mineração finalizada.";
                    } catch (Exception ex) {
                        ex.printStackTrace();
                        message = "Mineração abortada: " + ex.toString();
                        mineration.setComplete(false);
                        fail = true;
                    }
                    System.gc();
                    out.setCurrentProcess(message);
                    progress = 100;
                    subProgress = 100;
                    initialized = false;
                    mineration.setStoped(new Date());
                    mineration.setLog(out.getLog().toString());
                    dao.edit(mineration);
                }
            };
            process.start();
        }
View Full Code Here

TOP

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

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.