Package net.sf.collabreview.core.users

Examples of net.sf.collabreview.core.users.Author


  private Author getAuthorAndCheckAuthentication(HttpServletRequest request) {
    String accountName = request.getParameter("account");
    String password = request.getParameter("password");
    SessionAuthentication auth = (SessionAuthentication) request.getSession().getAttribute(SESSION_AUTHENTICATION_ATTRIBUTE_NAME);
    Author author;
    if (accountName == null || password == null) {
      if (auth == null) {
        logger.debug("login data missing");
        throw new IllegalArgumentException("login data missing");
      }
      author = CollabReviewSingleton.get().getAuthorManager().getAuthor(auth.getUserName());
      author.authenticate(auth.getPassword());
    } else {
      // wait a moment to reduce risk of brute force attacks
      try {
        Thread.sleep(500);
      } catch (InterruptedException e) {
      }
      logger.debug("Login attempt: " + accountName);
      author = CollabReviewSingleton.get().getAuthorManager().getAuthor(accountName);
      author.authenticate(password);
      auth = new SessionAuthentication(accountName, password);
    }
    if (!author.isAuthenticated()) {
      logger.warn("Authentication failed for user " + accountName);
      throw new IllegalArgumentException("login failed");
    }
    request.getSession().setAttribute(SESSION_AUTHENTICATION_ATTRIBUTE_NAME, auth);
    return author;
View Full Code Here


  @SuppressWarnings({"deprecation"})
  @Override
  public Author createAuthor(String name) {
    logger.debug("Creating new Author: " + name);
    return new Author(name);
  }
View Full Code Here

      sleepInterval = Long.parseLong(sleepConfig.getSelfValue()) * 1000;
    }
    logger.debug("Agent sleep interval is: " + sleepInterval / 1000 + " seconds");
    // ensure that the checkstyle author exists
    AuthorManager manager = agentManager.getCollabReview().getAuthorManager();
    Author author = manager.getAuthor(getProposedName());
    if (author == null) {
      logger.info("Registering a new author for the CheckstyleAgent: " + getProposedName());
      author = manager.createAuthor(getProposedName());
      if (manager.storeAuthor(author) == null) {
        logger.error("Failed to register the new author");
View Full Code Here

      }
      NavigableMap<Author, Float> result = new TreeMap<Author, Float>(cs);
      float contribSum = 0;
      AuthorManager authorManager = artifact.getRepository().getCollabReview().getAuthorManager();
      for (String authorName : cs.listKeys()) {
        Author author = authorManager.getAuthor(authorName);
        assert author.getName().equals(authorName);
        float authorContribution = cs.getContributionRatio(authorName);
        result.put(author, authorContribution);
        contribSum += authorContribution;
      }
      assert Math.abs(contribSum - 1) < 0.01f || cs.size() == 0;
View Full Code Here

      Pattern pattern = Pattern.compile("import (([a-z]+\\.)+).*;");
      Matcher matcher = pattern.matcher(content);
      while (matcher.find()) {
        String pack = matcher.group(1);
        assert pack != null;
        Author author = authorManager.getAuthor(pack);
        if (author == null) {
          author = authorManager.createAuthor(pack);
          authorManager.storeAuthor(author);
          authorManager.commit();
        }
View Full Code Here

    }
    NavigableMap<Author, Float> result = new TreeMap<Author, Float>(cs);
    float contribSum = 0;
    AuthorManager authorManager = artifact.getRepository().getCollabReview().getAuthorManager();
    for (String authorName : cs.listKeys()) {
      Author author = authorManager.getAuthor(authorName);
      assert author.getName().equals(authorName);
      float authorContribution = cs.getContributionRatio(authorName);
      result.put(author, authorContribution);
      contribSum += authorContribution;
    }
    assert Math.abs(contribSum - 1) < 0.01f || cs.size() == 0;
View Full Code Here

    assertNull(repository.getGrouping("parent"));
    assertNull(repository.getGrouping("child"));
  }

  public void testAddArtifact() {
    Artifact a1 = repository.addArtifact(new ArtifactIdentifier("x.java", 1, ""), new Date(1), "schnuck", new Author("Honk"));
    repository.createGrouping("group").addArtifact(a1);
    repository.commit();
    Grouping g = repository.getGrouping("group");
    assertNotNull(g);
    assertEquals(1, g.listArtifacts().size());
View Full Code Here

    if (getFilter() != null && !getFilter().filter(artifactIdentifier, repository)) {
      return;
    }
    Collection<Review> reviews = repository.listReviews(artifactIdentifier.getName(), artifactIdentifier.getBranch());
    Set<Author> authors = new HashSet<Author>();
    Author secondReviewer = null;
    for (Review review : reviews) {
      authors.add(review.getAuthor());
      if (!review.getAuthor().equals(newReview.getAuthor())) {
        secondReviewer = review.getAuthor();
      }
View Full Code Here

  protected synchronized void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    logger.debug("Servicing web service call");
    int nameLength = request.getParameter("name").length();
    String userName = request.getParameter("name").substring(0, nameLength - 4);
    Author author = collabReview.getAuthorManager().getAuthor(userName);
    response.setContentType("image/gif");
    String imageName;

    imageName = "00_bonehead";
    if (author != null) {  //check if user name exists in database
      Float userRespScore = collabReview.getReputationMetricManager().findReputationMetric("silfwiki").getAuthorScore(author.getName());
      if (userRespScore != null) {
        for (int i = 0; i < levelScore.length; i++) {
          if (userRespScore >= levelScore[i]) {
            imageName = levelName[i];
          }
View Full Code Here

        logger.debug("Set obsolete: " + deleted);
      } else {
        logger.warn("No latest artifact with name: " + articleName);
      }

      Author author = importer.getCollabReview().getAuthorManager().getAuthor(authorName);
      if (author == null) {
        author = importer.getCollabReview().getAuthorManager().createAuthor(authorName);
        author = importer.getCollabReview().getAuthorManager().storeAuthor(author);
        if (author == null) {
          logger.error("Failed to store the author; this will cause further exceptions...");
View Full Code Here

TOP

Related Classes of net.sf.collabreview.core.users.Author

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.