Example #1
0
  private void processDefaultTemplates() {
    ContextBuilder context = new ContextBuilder();
    fillProject(context.putSubContext("project"));
    fillWiki(context.putSubContext("wiki"));
    fillBlog(context.putSubContext("blog"));
    fillSprintBacklog(context.putSubContext("sprintBacklog"));
    fillProductBacklog(context.putSubContext("productBacklog"));
    fillBugs(context);
    fillIdeas(context);
    fillClosedIssues(context);
    fillReleases(context);
    fillIssues(context);
    fillStories(context);

    File[] templateFiles = templateDir.listFiles();
    if (templateFiles == null) return;
    for (File templateFile : templateFiles) {
      String templateName = templateFile.getName();
      if (!templateName.endsWith(".vm")) continue;
      if (templateName.equals(Velocity.LIB_TEMPLATE_NAME)) continue;
      if (templateName.startsWith("iss.")) continue;
      if (templateName.startsWith("blg.")) continue;
      if (templateName.startsWith("sto.")) continue;
      String outputFileName = Str.removeSuffix(templateName, ".vm");
      velocity.processTemplate(
          templateName, new File(outputDir.getPath() + "/" + outputFileName), context);
    }
  }
Example #2
0
 private void fillComment(ContextBuilder context, Comment comment) {
   context.put("id", comment.getId());
   context.put("text", wiki2html(comment.getText()));
   context.put("author", comment.getAuthorLabel());
   context.put(
       "date",
       comment
           .getDateAndTime()
           .toString(DateAndTime.FORMAT_WEEKDAY_LONGMONTH_DAY_YEAR_HOUR_MINUTE));
 }
Example #3
0
 private void processReleaseTemplates() {
   List<Release> releases = new ArrayList<Release>(project.getReleases());
   Collections.sort(releases, Release.DATE_REVERSE_COMPARATOR);
   for (Release release : releases) {
     if (!release.isReleased()) continue;
     ContextBuilder context = new ContextBuilder();
     fillRelease(context.putSubContext("release"), release);
     String reference = release.getReference();
     processEntityTemplate(context, reference);
   }
 }
Example #4
0
 private void fillRelease(ContextBuilder context, Release release) {
   context.put("id", release.getId());
   context.put("reference", release.getReference());
   context.put("label", release.getLabel());
   context.put("note", wiki2html(release.getNote()));
   context.put("releaseNotes", wiki2html(release.getReleaseNotes()));
   context.put("releaseDate", release.getReleaseDate());
   context.put("released", release.isReleased());
   context.put("major", release.isMajor());
   context.put("bugfix", release.isBugfix());
   fillComments(context, release);
 }
Example #5
0
 private void fillClosedIssues(ContextBuilder context) {
   List<Issue> issues = new ArrayList<Issue>(project.getClosedIssues());
   Collections.sort(issues, Issue.CLOSE_DATE_COMPARATOR);
   for (Issue issue : issues) {
     fillIssue(context.addSubContext("closedIssues"), issue);
   }
 }
Example #6
0
 private void fillIdeas(ContextBuilder context) {
   List<Issue> issues = new ArrayList<Issue>(project.getOpenIdeas());
   Collections.sort(issues, Issue.ACCEPT_DATE_COMPARATOR);
   for (Issue issue : issues) {
     fillIssue(context.addSubContext("ideas"), issue);
   }
 }
Example #7
0
 private void fillBugs(ContextBuilder context) {
   List<Issue> issues = new ArrayList<Issue>(project.getBugsInCurrentRelease());
   Collections.sort(issues, Issue.ACCEPT_DATE_COMPARATOR);
   for (Issue issue : issues) {
     fillIssue(context.addSubContext("bugs"), issue);
   }
 }
Example #8
0
 private void fillProductBacklog(ContextBuilder context) {
   List<Requirement> requirements = new ArrayList<Requirement>(project.getRequirements());
   Collections.sort(requirements, project.getRequirementsOrderComparator());
   for (Requirement requirement : requirements) {
     if (requirement.isClosed() || requirement.isInCurrentSprint()) continue;
     fillStory(context.addSubContext("stories"), requirement);
   }
 }
Example #9
0
 private void fillComments(ContextBuilder context, AEntity entity) {
   CommentDao commentDao = (CommentDao) entity.getDaoService().getDaoByClass(Comment.class);
   Collection<Comment> comments = commentDao.getPublishedCommentsByParent(entity);
   comments = Utl.sort(comments);
   for (Comment comment : comments) {
     fillComment(context.addSubContext("comments"), comment);
   }
 }
Example #10
0
 private void fillReleases(ContextBuilder context) {
   List<Release> releases = new ArrayList<Release>(project.getReleases());
   Collections.sort(releases, Release.DATE_REVERSE_COMPARATOR);
   for (Release release : releases) {
     if (!release.isReleased()) continue;
     fillRelease(context.addSubContext("releases"), release);
   }
 }
Example #11
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 #12
0
 private void fillBlog(ContextBuilder context) {
   List<BlogEntry> entries = new ArrayList<BlogEntry>(project.getBlogEntrys());
   Collections.sort(entries);
   for (BlogEntry entry : entries) {
     if (!entry.isPublished()) continue;
     fillBlogEntry(context.addSubContext("entries"), entry);
   }
 }
Example #13
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 #14
0
  private void processEntityTemplate(ContextBuilder context, String reference) {
    fillProject(context.putSubContext("project"));
    fillProductBacklog(context.putSubContext("productBacklog"));
    fillSprintBacklog(context.putSubContext("sprintBacklog"));
    fillWiki(context.putSubContext("wiki"));

    String prefix = reference.substring(0, 3);
    File[] templateFiles = templateDir.listFiles();
    if (templateFiles == null) return;
    for (File templateFile : templateFiles) {
      String templateName = templateFile.getName();
      if (!templateName.endsWith(".vm")) continue;
      if (!templateName.startsWith(prefix + ".")) continue;
      String outputFileName = Str.removeSuffix(templateName, ".vm");
      outputFileName = Str.removePrefix(outputFileName, prefix + ".");
      outputFileName = reference + "." + outputFileName;
      velocity.processTemplate(
          templateName, new File(outputDir.getPath() + "/" + outputFileName), context);
    }
  }
Example #15
0
 private void fillProject(ContextBuilder context) {
   context.put("id", project.getId());
   context.put("label", project.getLabel());
   context.put("vision", project.getVision());
   context.put("shortDescription", project.getShortDescription());
   context.put("description", wiki2html(project.getDescription()));
   context.put("longDescription", wiki2html(project.getLongDescription()));
   Release currentRelease = project.getCurrentRelease();
   context.put("currentRelease", currentRelease == null ? "?" : currentRelease.getLabel());
 }
Example #16
0
 private void fillBlogEntry(ContextBuilder context, BlogEntry entry) {
   context.put("id", entry.getId());
   context.put("reference", entry.getReference());
   context.put("title", entry.getTitle());
   context.put("text", wiki2html(entry.getText()));
   context.put("plainText", wiki2text(entry.getText()));
   DateAndTime date = entry.getDateAndTime();
   context.put("date", date.toString(Date.FORMAT_LONGMONTH_DAY_YEAR));
   context.put("rssDate", date.toString(DateAndTime.FORMAT_RFC822));
   fillComments(context, entry);
 }
Example #17
0
 private void fillStory(ContextBuilder context, Requirement requirement) {
   context.put("id", requirement.getId());
   context.put("reference", requirement.getReference());
   context.put("label", requirement.getLabel());
   context.put("description", wiki2html(requirement.getDescription()));
   context.put("testDescription", wiki2html(requirement.getTestDescription()));
   if (requirement.isEstimatedWorkSet() && !requirement.isDirty())
     context.put("estimatedWork", requirement.getEstimatedWorkAsString());
   fillComments(context, requirement);
 }
Example #18
0
 private void fillSprintBacklog(ContextBuilder context) {
   Sprint sprint = project.getCurrentSprint();
   context.put("label", sprint.getLabel());
   context.put("goal", wiki2html(sprint.getGoal()));
   context.put("begin", sprint.getBegin().toString(Date.FORMAT_LONGMONTH_DAY_YEAR));
   context.put("end", sprint.getEnd().toString(Date.FORMAT_LONGMONTH_DAY_YEAR));
   Release release = sprint.getRelease();
   if (release != null) context.put("release", release.getLabel());
   List<Requirement> requirements = new ArrayList<Requirement>(sprint.getRequirements());
   Collections.sort(requirements, project.getRequirementsOrderComparator());
   for (Requirement requirement : requirements) {
     fillStory(context.addSubContext("stories"), requirement);
   }
 }
Example #19
0
 private void processBlogEntryTemplate(BlogEntry entry) {
   ContextBuilder context = new ContextBuilder();
   fillBlogEntry(context.putSubContext("entry"), entry);
   processEntityTemplate(context, entry.getReference());
 }
Example #20
0
 private void processStoryTemplate(Requirement requirement) {
   ContextBuilder context = new ContextBuilder();
   fillStory(context.putSubContext("story"), requirement);
   processEntityTemplate(context, requirement.getReference());
 }
Example #21
0
 private void fillWiki(ContextBuilder context) {
   for (Wikipage page : project.getWikipages()) {
     context.put(page.getName(), wiki2html(page.getText()));
   }
 }
Example #22
0
 private void fillStories(ContextBuilder context) {
   for (Requirement requirement : project.getRequirements()) {
     if (requirement.isClosed()) continue;
     fillStory(context.addSubContext("stories"), requirement);
   }
 }
Example #23
0
 public void processIssueTemplate(Issue issue) {
   ContextBuilder context = new ContextBuilder();
   fillIssue(context.putSubContext("issue"), issue);
   processEntityTemplate(context, issue.getReference());
 }