Example #1
0
 private void fillIssues(ContextBuilder context) {
   List<Issue> issues = new ArrayList<Issue>(project.getBugsInCurrentRelease());
   Collections.sort(issues, Issue.ACCEPT_DATE_COMPARATOR);
   for (Issue issue : project.getIssues()) {
     if (!issue.isPublished()) continue;
     fillIssue(context.addSubContext("issues"), issue);
   }
 }
Example #2
0
 public Set<Issue> getBugsInCurrentRelease() {
   Release release = getCurrentRelease();
   Release nextRelease = getNextRelease();
   if (release == null) return getOpenBugs();
   Set<Issue> ret = new HashSet<Issue>();
   ret.addAll(getOpenBugs());
   for (Issue issue : getClosedIssues()) {
     if (issue.containsFixRelease(nextRelease) && !issue.containsFixRelease(release))
       ret.add(issue);
   }
   return ret;
 }
Example #3
0
 private void fillIssue(ContextBuilder context, Issue issue) {
   context.put("id", issue.getId());
   context.put("reference", issue.getReference());
   context.put("label", issue.getLabel());
   context.put("description", wiki2html(issue.getDescription()));
   context.put("statement", wiki2html(issue.getStatement()));
   context.put("statusText", issue.getStatusText());
   if (issue.isOwnerSet()) context.put("owner", issue.getOwner().getName());
   if (issue.isFixed()) context.put("fixed", "true");
   fillComments(context, issue);
 }
Example #4
0
  private String submitIssue(
      String projectId,
      String label,
      String text,
      String additionalInfo,
      String externalTrackerId,
      String name,
      String email,
      boolean wiki,
      boolean publish,
      String remoteHost) {
    if (projectId == null) throw new RuntimeException("projectId == null");
    if (Str.isBlank(label))
      throw new RuntimeException(
          "Subject is empty, but required. Please write a short title for your issue.");
    if (Str.isBlank(text))
      throw new RuntimeException(
          "Text is empty, but required. Please wirte a short description of your issue.");
    Project project = projectDao.getById(projectId);
    String textAsWiki = wiki ? text : "<nowiki>" + text + "</nowiki>";
    Issue issue =
        issueDao.postIssue(
            project, label, textAsWiki, additionalInfo, externalTrackerId, name, email, publish);
    if (publish) {
      project.updateHomepage(issue);
    }
    String issuer = issue.getIssuer();
    if (Str.isBlank(issuer)) issuer = "anonymous";
    ProjectEvent event =
        projectEventDao.postEvent(
            project, issuer + " submitted " + issue.getReferenceAndLabel(), issue);
    if (Str.isEmail(email)) subscriptionService.subscribe(email, issue);
    transactionService.commit();

    webApplication.sendToConversationsByProject(project, issue);
    webApplication.sendToConversationsByProject(project, event);

    String issueLink =
        publish
            ? KunagiUtl.createExternalRelativeHtmlAnchor(issue)
            : "<code>" + issue.getReference() + "</code>";
    return "<h2>Feedback submitted</h2><p>Thank you for your feedback!</p><p>Your issue is now known as "
        + issueLink
        + " and will be reviewed by our Product Owner.</p>";
  }
Example #5
0
 @Override
 public void onSendIssueReplyEmail(
     GwtConversation conversation,
     String issueId,
     String from,
     String to,
     String subject,
     String text) {
   assertProjectSelected(conversation);
   Issue issue = issueDao.getById(issueId);
   if (Str.isEmail(from)) {
     emailSender.sendEmail(conversation.getProject(), to, subject, text);
   } else {
     emailSender.sendEmail(from, to, subject, text);
   }
   User user = conversation.getSession().getUser();
   postProjectEvent(
       conversation,
       user.getName() + " emailed a response to " + issue.getReferenceAndLabel(),
       issue);
   Change change = changeDao.postChange(issue, user, "@reply", null, text);
   conversation.sendToClient(change);
 }
Example #6
0
 @Override
 public void onConvertIssueToStory(GwtConversation conversation, String issueId) {
   Issue issue = issueDao.getById(issueId);
   Requirement story = requirementDao.postRequirement(issue);
   issue.appendToStatement("Created Story " + story.getReference() + " in Product Backlog.");
   issue.setCloseDate(Date.today());
   sendToClients(conversation, story);
   sendToClients(conversation, issue);
   User currentUser = conversation.getSession().getUser();
   postProjectEvent(
       conversation,
       currentUser.getName()
           + " created "
           + story.getReference()
           + " from "
           + issue.getReferenceAndLabel(),
       issue);
   changeDao.postChange(issue, currentUser, "storyId", null, story.getId());
   changeDao.postChange(story, currentUser, "issueId", null, issue.getId());
   subscriptionService.copySubscribers(issue, story);
   subscriptionService.notifySubscribers(
       story, "Story created from " + issue, conversation.getProject(), null);
 }
Example #7
0
 @Override
 public int compare(Issue a, Issue b) {
   return Utl.compare(b.getDate(), a.getDate());
 }
Example #8
0
 public void processIssueTemplate(Issue issue) {
   ContextBuilder context = new ContextBuilder();
   fillIssue(context.putSubContext("issue"), issue);
   processEntityTemplate(context, issue.getReference());
 }
Example #9
0
  private void onIssueChanged(GwtConversation conversation, Issue issue, Map properties) {
    User currentUser = conversation.getSession().getUser();

    if (properties.containsKey("closeDate")) {
      if (issue.isClosed()) {
        issue.setCloseDate(Date.today());
        postProjectEvent(
            conversation, currentUser.getName() + " closed " + issue.getReferenceAndLabel(), issue);
        subscriptionService.notifySubscribers(
            issue, "Issue closed", conversation.getProject(), null);
      } else {
        postProjectEvent(
            conversation,
            currentUser.getName() + " reopened " + issue.getReferenceAndLabel(),
            issue);
        subscriptionService.notifySubscribers(
            issue, "Issue reopened", conversation.getProject(), null);
      }
    }

    if (properties.containsKey("ownerId") && issue.isOwnerSet()) {
      if (!issue.isFixed()) {
        postProjectEvent(
            conversation,
            currentUser.getName() + " claimed " + issue.getReferenceAndLabel(),
            issue);
      }

      Release nextRelease = issue.getProject().getNextRelease();
      if (nextRelease != null && issue.isFixReleasesEmpty()) {
        issue.setFixReleases(Collections.singleton(nextRelease));
      }
    }

    if (properties.containsKey("fixDate")) {
      if (issue.isFixed()) {
        postProjectEvent(
            conversation, currentUser.getName() + " fixed " + issue.getReferenceAndLabel(), issue);
      } else {
        postProjectEvent(
            conversation,
            currentUser.getName() + " rejected fix for " + issue.getReferenceAndLabel(),
            issue);
      }
    }

    if (properties.containsKey("urgent")) {
      if (issue.isBug()) {
        Release currentRelease = issue.getProject().getCurrentRelease();
        if (issue.isAffectedReleasesEmpty() && currentRelease != null) {
          issue.setAffectedReleases(Collections.singleton(currentRelease));
        }
      }
    }

    if (properties.containsKey("acceptDate")) {
      if (issue.isIdea() || issue.isBug()) {
        postProjectEvent(
            conversation,
            currentUser.getName() + " accepted " + issue.getReferenceAndLabel(),
            issue);
        subscriptionService.notifySubscribers(
            issue, "Issue accepted", conversation.getProject(), null);
      }
    }

    issue.getProject().updateHomepage(issue, false);
  }
Example #10
0
  @Override
  public void onCreateEntity(GwtConversation conversation, String type, Map properties) {
    String id = (String) properties.get("id");
    if (id == null) throw new NullPointerException("id == null");

    ADao dao = getDaoService().getDaoByName(type);
    AEntity entity = dao.newEntityInstance(id);
    entity.updateProperties(properties);
    User currentUser = conversation.getSession().getUser();
    Project currentProject = conversation.getProject();

    if (entity instanceof Numbered) {
      ((Numbered) entity).updateNumber();
    }

    if (entity instanceof Project) {
      Project project = (Project) entity;
      project.addParticipant(currentUser);
      project.addAdmin(currentUser);
      project.addProductOwner(currentUser);
      project.addScrumMaster(currentUser);
      project.addTeamMember(currentUser);
    }

    if (entity instanceof Comment) {
      Comment comment = (Comment) entity;
      comment.setDateAndTime(DateAndTime.now());
      postProjectEvent(
          conversation,
          comment.getAuthor().getName() + " commented on " + comment.getParent(),
          comment.getParent());
      currentProject.updateHomepage(comment.getParent(), true);
    }

    if (entity instanceof ChatMessage) {
      ChatMessage chatMessage = (ChatMessage) entity;
      chatMessage.setDateAndTime(DateAndTime.now());
    }

    if (entity instanceof Impediment) {
      Impediment impediment = (Impediment) entity;
      impediment.setDate(Date.today());
    }

    if (entity instanceof Issue) {
      Issue issue = (Issue) entity;
      issue.setDate(DateAndTime.now());
      issue.setCreator(currentUser);
    }

    if (entity instanceof Task) {
      Task task = (Task) entity;
      Requirement requirement = task.getRequirement();
      requirement.setRejectDate(null);
      requirement.setClosed(false);
      sendToClients(conversation, requirement);
    }

    if (entity instanceof BlogEntry) {
      BlogEntry blogEntry = (BlogEntry) entity;
      blogEntry.setDateAndTime(DateAndTime.now());
      blogEntry.addAuthor(currentUser);
    }

    if (entity instanceof Change) {
      Change change = (Change) entity;
      change.setDateAndTime(DateAndTime.now());
      change.setUser(currentUser);
    }

    if (!(entity instanceof Transient)) dao.saveEntity(entity);

    sendToClients(conversation, entity);

    if (entity instanceof Requirement) {
      Requirement requirement = (Requirement) entity;
      Requirement epic = requirement.getEpic();
      String value = null;
      if (epic != null) {
        value = epic.getReferenceAndLabel();
        Change change =
            changeDao.postChange(epic, currentUser, "@split", null, requirement.getReference());
        conversation.sendToClient(change);
      }
      Change change = changeDao.postChange(requirement, currentUser, "@created", null, value);
      conversation.sendToClient(change);
    }

    if (entity instanceof Task
        || entity instanceof Wikipage
        || entity instanceof Risk
        || entity instanceof Impediment
        || entity instanceof Issue
        || entity instanceof BlogEntry) {
      Change change = changeDao.postChange(entity, currentUser, "@created", null, null);
      conversation.sendToClient(change);
    }

    if (currentUser != null && currentProject != null) {
      ProjectUserConfig config = currentProject.getUserConfig(currentUser);
      config.touch();
      sendToClients(conversation, config);
    }
  }
Example #11
0
  public void addTestIssues() {
    Issue iss = null;

    // noobs
    iss = issueDao.postIssue(this, "thiz cr4p don't work, n00bz!!1");
    iss.setDescription("go home, u noobz ..#");

    // eclipse integration
    iss = issueDao.postIssue(this, "I want eclipse integration");
    iss.setDescription(
        "I would be really nice if eclipse commits would be represented in Kunagi! Thank you!");

    // link bug
    iss = issueDao.postIssue(this, "Bug: Links don't work");
    iss.setDescription("When I try to post links to other pages, I get links to the Wiki. WTF?");

    // date crash
    iss = issueDao.postIssue(this, "Crash when using Dates after 2012");
    iss.setDescription(
        "The program crashes whenever I enter dates after 2012. Can't figure out what the problem is though.");
    iss.setAcceptDate(Date.beforeDays(2));
    iss.setUrgent(true);
    iss.setSeverity(scrum.client.issues.Issue.SEVERE);

    // gui bug
    iss = issueDao.postIssue(this, "GUI inconsistency between PB and SB");
    iss.setDescription(
        "The order of Qualities and Tests is different between widgets in the PB and SB. It should be the same.");
    iss.setAcceptDate(Date.beforeDays(35));
    iss.setUrgent(true);
    iss.setSeverity(scrum.client.issues.Issue.MINOR);

    // navi display bug
    iss = issueDao.postIssue(this, "navigation displays wrong current view");
    iss.setDescription(
        "When I open the Whiteboard, \"Sprint Backlog\" is selected in the navigation. Same for other jumps.");
    iss.setAcceptDate(Date.today());
    iss.setUrgent(true);
    iss.setSeverity(scrum.client.issues.Issue.MINOR);
    iss.setIssuerName("Witek");
    iss.setIssuerEmail("*****@*****.**");

    // terrific pb suggestion
    iss = issueDao.postIssue(this, "Product Backlog should be terrific, not amazing");
    iss.setDescription(
        "56% of users want a terrific PB, not an amazing one. We should change that in one of the upcoming releases.");
    iss.setAcceptDate(Date.today());

    // flattr
    iss = issueDao.postIssue(this, "Add a flattr-button");
    iss.setDescription("See [http://flattr.com].");
    iss.setCloseDate(Date.beforeDays(1));

    // thank you
    iss = issueDao.postIssue(this, "I like this software, thank you!");
    iss.setDescription("I'm using Kunagi for my own project now. Thanks for the great work.");
    iss.setCloseDate(Date.today());
  }