Ejemplo n.º 1
0
 @Override
 public void setWorker(String issueKey, String username) {
   Worker[] workers = ao.find(Worker.class, Query.select().where("ISSUE_KEY = ?", issueKey));
   if (workers.length > 1) log.error("found more than one worker for one issue");
   if (workers.length == 0) {
     ao.create(Worker.class, EasyMap.build("ISSUE_KEY", issueKey, "WORKER_USER", username));
   } else {
     Worker worker = workers[0];
     String oldUserName = worker.getWorkerUser();
     if (oldUserName.equals(username)) return;
     worker.setWorkerUser(username);
     worker.save();
   }
 }
Ejemplo n.º 2
0
 @Override
 public void addRating(String issueKey, String who, String whom, int rating, String comment) {
   ao.create(
       Rate.class,
       EasyMap.build(
           "ISSUE_KEY",
           issueKey,
           "WHO",
           who,
           "WHOM",
           whom,
           "RATING",
           rating,
           "COMMENT",
           comment,
           "WHEN",
           new Date()));
 }
 // static methods for getting by id, etc.
 public static PullRequestDisapproval getPullRequestDisapproval(ActiveObjects ao, PullRequest pr)
     throws SQLException {
   Repository repo = pr.getToRef().getRepository();
   PullRequestDisapproval[] disapprovals =
       ao.find(
           PullRequestDisapproval.class,
           Query.select().where("REPO_ID = ? and PR_ID = ?", repo.getId(), pr.getId()));
   if (disapprovals.length == 0) {
     PullRequestDisapproval prd =
         ao.create(
             PullRequestDisapproval.class,
             new DBParam("REPO_ID", repo.getId()),
             new DBParam("PR_ID", pr.getId()),
             new DBParam("USERNAME", "None"));
     prd.save();
     return prd;
   }
   return disapprovals[0];
 }
 public static void setPullRequestDisapproval(
     ActiveObjects ao, PullRequest pr, String username, boolean isDisapproved)
     throws SQLException {
   Repository repo = pr.getToRef().getRepository();
   PullRequestDisapproval[] disapprovals =
       ao.find(
           PullRequestDisapproval.class,
           Query.select().where("REPO_ID = ? and PR_ID = ?", repo.getId(), pr.getId()));
   if (disapprovals.length == 0) {
     PullRequestDisapproval prd =
         ao.create(
             PullRequestDisapproval.class,
             new DBParam("REPO_ID", repo.getId()),
             new DBParam("PR_ID", pr.getId()),
             new DBParam("USERNAME", username));
     prd.setDisapproved(isDisapproved);
     prd.save();
     return;
   }
   disapprovals[0].setDisapprovedBy(username);
   disapprovals[0].setDisapproved(isDisapproved);
   disapprovals[0].save();
 }