Exemplo n.º 1
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);
 }
Exemplo n.º 2
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>";
  }
Exemplo n.º 3
0
 public void processIssueTemplate(Issue issue) {
   ContextBuilder context = new ContextBuilder();
   fillIssue(context.putSubContext("issue"), issue);
   processEntityTemplate(context, issue.getReference());
 }