Package net.sf.collabreview.core

Examples of net.sf.collabreview.core.Repository


          int totalMicroEditsBefore = 0;
          int totalMicroEditsAfter = 0;
          int totalRevisionsBefore = 0;
          int totalRevisionsAfter = 0;
          result.append("<table border=1>\n");
          Repository repository = collabReview.getRepository();
          TreeSet<String> articles = new TreeSet<String>();
          for (ArtifactIdentifier artifactIdentifier : repository.listAllArtifacts()) {
            articles.add(artifactIdentifier.getName());
            /*articles.add("GreenIT");
            articles.add("Hydra_JF");
            articles.add("Reputationforge");
            articles.add("Issues");
            articles.add("Enocean");
            articles.add("Projekt_BRIDGE");
            articles.add("Zeitschriften-Wunschliste");*/
          }
          for (String article : articles) {
            logger.debug("Computing micro edits for article " + article);
            Artifact artifact = repository.getLatestForName(article, "");
            int beforeCount = MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, microEditCastigatorInstallTime, surveyPeriod);
            int afterCount = MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, microEditCastigatorInstallTime + surveyPeriod, surveyPeriod);
            totalMicroEditsBefore += beforeCount;
            totalMicroEditsAfter += afterCount;
            result.append(String.format("<tr><td>%s</td><td>%d</td><td>%d</td>", article, beforeCount, afterCount));
            for (int i = 0; i < 2 * slices; i++) {
              int microEditCount = MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, microEditCastigatorInstallTime + surveyPeriod - i * surveyPeriod / slices, surveyPeriod / slices);
              microEditCounts[i] += microEditCount;
              result.append("<td>").append(microEditCount).append("</td>");
            }
            result.append("</tr>\n");
            repository.commit();
          }
          result.append(String.format("<tr><td>Total</td><td>%d</td><td>%d</td>", totalMicroEditsBefore, totalMicroEditsAfter));
          for (int i = 0; i < 2 * slices; i++) {
            result.append("<td>").append(microEditCounts[i]).append("</td>");
          }
          result.append("</tr>\n");
          logger.debug("Counting revisions...");
          for (ArtifactIdentifier artifactIdentifier : repository.listAllArtifacts()) {
            long time = repository.getArtifact(artifactIdentifier).getDate().getTime();
            if (time > microEditCastigatorInstallTime - surveyPeriod && time < microEditCastigatorInstallTime) {
              totalRevisionsBefore++;
            }
            if (time > microEditCastigatorInstallTime && time < microEditCastigatorInstallTime + surveyPeriod) {
              totalRevisionsAfter++;
            }
            repository.commit();
          }
          result.append(String.format("<tr><td>Total revisions</td><td>%d</td><td>%d</td></tr>\n", totalRevisionsBefore, totalRevisionsAfter));
          result.append("</table>\n");
          logger.debug("done");
        }
View Full Code Here


      public void artifactAdded(Repository repository, Artifact artifact) {
        runReview(repository, artifact);
      }
    });
    if (checkOldReviews) {
      Repository repository = agentManager.getCollabReview().getRepository();
      Collection<Review> reviews = repository.listReviewsBy(getReviewerIdentity());
      logger.info("Checking all of my existing " + reviews.size() + " reviews if they are still valid");
      for (Review review : reviews) {
        Artifact artifact = repository.getArtifact(review.getArtifactIdentifier());
        assert artifact != null;
        StringBuilder sb = new StringBuilder();
        Integer newRating = generateReview(sb, artifact);
        if (newRating == null) {
          logger.warn("Could not create a new review in place of " + review);
          continue;
        }
        if (newRating != review.getRating() || !sb.toString().equals(review.getReviewText())) {
          logger.info("Old review is no longer valid. Updating...");
          review.setRating(newRating);
          review.setReviewText(sb.toString());
        }
      }
      repository.commit();
    }
  }
View Full Code Here

        new Float[]{1.0f, 1.0f, 0.8824786f, 0.6983204f, 0.5299145f});
  }

  public void testTrivialQuality() {
    repo.reset();
    Repository oldRepo = repo;
    collabReview = AutoConfigurator.newConfiguredApplication();
    rmm = collabReview.getReputationMetricManager();
    authorManager = collabReview.getAuthorManager();
    repo = collabReview.getRepository();
    assert oldRepo != repo;
View Full Code Here

TOP

Related Classes of net.sf.collabreview.core.Repository

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.