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

Examples of br.edu.utfpr.cm.JGitMinerWeb.model.matrix.EntityMatrix


        System.out.println(params.get("dataInicial"));
        System.out.println(params.get("dataFinal"));
       
       
       
        EntityMatrix matrix = new EntityMatrix();
        matrix.getNodes().add(new EntityMatrixNode("eduaro;carro.java;5"));
        matrix.getNodes().add(new EntityMatrixNode("douglas;pessoa.java;6"));
       
        matricesToSave.add(matrix);
    }
View Full Code Here


    public GitMatrixViewBean() {
    }

    public void deleteMatrixInSession() {
        try {
            EntityMatrix matrixForDelete = (EntityMatrix) JsfUtil.getObjectFromSession(FOR_DELETE);
            dao.remove(matrixForDelete);
            reloadList();
        } catch (Exception ex) {
            ex.printStackTrace();
            JsfUtil.addErrorMessage(ex.toString());
View Full Code Here

        } else {
            initialized = true;
            progress = 1;
            final int fraction = 100 / paramsQueue.size();
            for (final Map<Object, Object> params : paramsQueue) {
                final EntityMatrix matrix = (EntityMatrix) params.get("matrix");
                params.putAll(matrix.getParams());
                out.resetLog();

                out.printLog("");
                out.printLog("Params: " + params);
                out.printLog("");
View Full Code Here

            incrementNode(nodes, rec);
        }

        System.out.println("Result: " + query.size());

        EntityMatrix matrix = new EntityMatrix();
        matrix.setNodes(objectsToNodes(nodes));
        matricesToSave.add(matrix);
    }
View Full Code Here

            }
        }

        System.out.println("Result : " + result.size());

        EntityMatrix matrix = new EntityMatrix();
        matrix.setNodes(objectsToNodes(result));
        matricesToSave.add(matrix);
    }
View Full Code Here

            beginDate = (Date) endDate.clone();
            cal.setTime((Date) beginDate.clone());
            cal.add(Calendar.MONTH, getIntervalOfMonths());
            endDate = cal.getTime();
            out.printLog("Iniciando geração da rede:  " + beginDate + "  =>  " + endDate);
            EntityMatrix matrix = generateMatrix();
            dao.clearCache(true);
            System.gc();
            saveMatrix(matrix);
            out.resetLog();
            dao.clearCache(true);
View Full Code Here

    public String getHeadCSV() {
        return "user;file;file2;user2;weigth";
    }

    private EntityMatrix generateMatrix() {
        EntityMatrix matrix = new EntityMatrix();
        matrix.setStarted(new Date());
        matrix.getParams().put("matrixBeginDate", beginDate);
        matrix.getParams().put("matrixEndDate", endDate);

        List<AuxUserFileFileUserDirectional> result = new ArrayList<>();

        List<String> filesName = getFilesName();
        String prefix = getPrefixFile();
        String suffix = getSuffixFile();

        // select a issue/pullrequest comments
        List<EntityIssue> issuesCommenteds;

        if (!filesName.isEmpty()) {
            String jpql = "SELECT DISTINCT i "
                    + "FROM "
                    + "EntityPullRequest p JOIN p.issue i JOIN p.repositoryCommits rc JOIN rc.files f "
                    + "WHERE "
                    + "p.repository = :repo AND "
                    + "p.createdAt BETWEEN :beginDate AND :endDate AND "
                    + "i.commentsCount > 1  AND "
                    + "f.filename IN :filesName";

            System.out.println(jpql);

            issuesCommenteds = dao.selectWithParams(jpql,
                    new String[]{"repo", "beginDate", "endDate", "filesName"},
                    new Object[]{getRepository(), beginDate, endDate, filesName});
        } else if (prefix.length() > 1 || suffix.length() > 1) {
            String jpql = "SELECT DISTINCT i "
                    + "FROM "
                    + "EntityPullRequest p JOIN p.issue i JOIN p.repositoryCommits rc JOIN rc.files f "
                    + "WHERE "
                    + "p.repository = :repo AND "
                    + "p.createdAt BETWEEN :beginDate AND :endDate AND "
                    + "i.commentsCount > 1  "
                    + (prefix.length() > 1 ? " AND f.filename LIKE :prefix " : "")
                    + (suffix.length() > 1 ? " AND f.filename LIKE :suffix " : "");

            System.out.println(jpql);

            issuesCommenteds = dao.selectWithParams(jpql,
                    new String[]{"repo",
                        "beginDate",
                        "endDate",
                        (prefix.length() > 1 ? "prefix " : "#none#"),
                        (suffix.length() > 1 ? "suffix" : "#none#")},
                    new Object[]{getRepository(),
                        beginDate,
                        endDate,
                        prefix,
                        suffix});
        } else {
            String jpql = "SELECT DISTINCT i "
                    + "FROM "
                    + "EntityPullRequest p JOIN p.issue i "
                    + "WHERE "
                    + "p.repository = :repo AND "
                    + "p.createdAt BETWEEN :beginDate AND :endDate AND "
                    + "i.commentsCount > 1 ";

            System.out.println(jpql);

            issuesCommenteds = dao.selectWithParams(jpql,
                    new String[]{"repo", "beginDate", "endDate"},
                    new Object[]{getRepository(), beginDate, endDate});
        }

        out.printLog("Issues comentadas: " + issuesCommenteds.size());

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

            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());
                }
            }

            out.printLog(commitFiles.size() + " files in pull request ");

            Set<AuxFileFile> tempResultFiles = new HashSet<>();

            for (int i = 0; i < commitFiles.size(); i++) {
                EntityCommitFile file1 = commitFiles.get(i);
                for (int j = i + 1; j < commitFiles.size(); j++) {
                    EntityCommitFile file2 = commitFiles.get(j);
                    if (!file1.equals(file2)
                            && !Util.stringEquals(file1.getFilename(), file2.getFilename())) {
                        tempResultFiles.add(new AuxFileFile(file1.getFilename(), file2.getFilename()));
                    }
                }
            }
            commitFiles.clear();

            jpql = "SELECT c "
                    + " FROM EntityComment c "
                    + " WHERE c.issue = :issue "
                    + " ORDER BY c.createdAt ";

            System.out.println(jpql);

            List<EntityComment> comments = dao.selectWithParams(jpql,
                    new String[]{"issue"},
                    new Object[]{issue});
            out.printLog(comments.size() + " comments");

            List<AuxUserUserDirectional> tempResultUsers = new ArrayList<>();

            for (int k = 0; k < comments.size(); k++) {
                EntityComment iCom = comments.get(k);
                for (int l = k - 1; l >= 0; l--) {
                    EntityComment jCom = comments.get(l);
                    if (iCom.getUser().equals(jCom.getUser())) {
                        break;
                    }
                    boolean contem = false;
                    AuxUserUserDirectional aux = new AuxUserUserDirectional(
                            iCom.getUser().getLogin(),
                            iCom.getUser().getEmail(),
                            jCom.getUser().getLogin(),
                            jCom.getUser().getEmail());
                    for (AuxUserUserDirectional a : tempResultUsers) {
                        if (a.equals(aux)) {
                            a.inc();
                            contem = true;
                            break;
                        }
                    }
                    if (!contem) {
                        tempResultUsers.add(aux);
                    }
                }
            }
            comments.clear();

            for (AuxUserUserDirectional users : tempResultUsers) {
                for (AuxFileFile files : tempResultFiles) {
                    AuxUserFileFileUserDirectional aux = new AuxUserFileFileUserDirectional(
                            users.getUser(),
                            files.getFileName(),
                            files.getFileName2(),
                            users.getUser2(),
                            users.getWeigth());
                    boolean contem = false;
                    for (AuxUserFileFileUserDirectional a : result) {
                        if (a.equals(aux)) {
                            a.inc();
                            contem = true;
                            break;
                        }
                    }
                    if (!contem) {
                        result.add(aux);
                    }
                }
            }

            count++;
            out.printLog("Temp user result: " + result.size());
        }

        matrix.setNodes(objectsToNodes(result));
        result.clear();
        return matrix;
    }
View Full Code Here

       
        if (getRepository() == null) {
            throw new IllegalArgumentException("Parâmetro Repository não pode ser nulo.");
        }
       
        EntityMatrix matrix = new EntityMatrix();
        matricesToSave.add(matrix);
       
       
    }
View Full Code Here

        }

        out.printLog("Number of pair files: " + realPairFilesCount);
        out.printLog("Result: " + result.size());

        EntityMatrix matrix = new EntityMatrix();
        matrix.setNodes(objectsToNodes(result.values()));
        matricesToSave.add(matrix);
    }
View Full Code Here

            result = getByDate();
        }

        System.out.println("Nodes: " + result.size());

        EntityMatrix matrix = new EntityMatrix();
        matrix.setNodes(objectsToNodes(result));
        matricesToSave.add(matrix);
    }
View Full Code Here

TOP

Related Classes of br.edu.utfpr.cm.JGitMinerWeb.model.matrix.EntityMatrix

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.