/testability-explorer/src/main/java/com/google/test/metric/report/DiffReport.java
Java | 69 lines | 48 code | 15 blank | 6 comment | 0 complexity | c5a827bdc5c73a293f87fd2072b4a627 MD5 | raw file
1package com.google.test.metric.report; 2 3import java.io.IOException; 4import java.io.Writer; 5import java.util.Date; 6import java.util.List; 7 8import freemarker.template.Configuration; 9import freemarker.template.Template; 10import freemarker.template.TemplateException; 11 12/** 13 * Represents a report on the difference between two reports, suitable for 14 * rendering. Also knows how to render itself using Freemarker. 15 * 16 * @author alexeagle@google.com (Alex Eagle) 17 */ 18public class DiffReport { 19 private Configuration cfg; 20 private final Diff diff; 21 private String oldSourceUrl; 22 private String newSourceUrl; 23 private String changelistUrl; 24 25 public DiffReport(Diff diff, Configuration cfg) { 26 this.diff = diff; 27 diff.sort(); 28 this.cfg = cfg; 29 30 } 31 32 public void writeHtml(Writer out) throws IOException, TemplateException { 33 Template template = cfg.getTemplate("diff.html"); 34 template.process(this, out); 35 } 36 37 public List<Diff.ClassDiff> getClassDiffs() { 38 return diff.getClassDiffs(); 39 } 40 41 public Date getCurrentTime() { 42 return new Date(); 43 } 44 45 public String getOldSourceUrl() { 46 return oldSourceUrl; 47 } 48 49 public String getNewSourceUrl() { 50 return newSourceUrl; 51 } 52 53 public void setOldSourceUrl(String oldSourceUrl) { 54 this.oldSourceUrl = oldSourceUrl; 55 } 56 57 public void setNewSourceUrl(String newSourceUrl) { 58 this.newSourceUrl = newSourceUrl; 59 } 60 61 public String getChangelistUrl() { 62 return changelistUrl; 63 } 64 65 public void setChangelistUrl(String changelistUrl) { 66 this.changelistUrl = changelistUrl; 67 } 68 69}