Пример #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);
    }
  }
Пример #2
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);
    }
  }
Пример #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);
   }
 }
Пример #4
0
 private void processBlogEntryTemplate(BlogEntry entry) {
   ContextBuilder context = new ContextBuilder();
   fillBlogEntry(context.putSubContext("entry"), entry);
   processEntityTemplate(context, entry.getReference());
 }
Пример #5
0
 private void processStoryTemplate(Requirement requirement) {
   ContextBuilder context = new ContextBuilder();
   fillStory(context.putSubContext("story"), requirement);
   processEntityTemplate(context, requirement.getReference());
 }
Пример #6
0
 public void processIssueTemplate(Issue issue) {
   ContextBuilder context = new ContextBuilder();
   fillIssue(context.putSubContext("issue"), issue);
   processEntityTemplate(context, issue.getReference());
 }