From bbebb4d2dc8cc20f15bda5d5b852d80881fa5e44 Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Fri, 15 Oct 2010 13:26:25 +0000 Subject: [PATCH] Add @Overrides so we get warned about API changes git-svn-id: http://google-refine.googlecode.com/svn/trunk@1565 7d457c2a-affb-35e4-300a-418c747d4874 --- .../refine/exporters/HtmlTableExporter.java | 21 +++++++------------ .../refine/exporters/TemplatingExporter.java | 17 +++++---------- .../google/refine/exporters/XlsExporter.java | 18 ++++++---------- 3 files changed, 18 insertions(+), 38 deletions(-) diff --git a/main/src/com/google/refine/exporters/HtmlTableExporter.java b/main/src/com/google/refine/exporters/HtmlTableExporter.java index 1f5e9e71d..d334c38b2 100644 --- a/main/src/com/google/refine/exporters/HtmlTableExporter.java +++ b/main/src/com/google/refine/exporters/HtmlTableExporter.java @@ -1,7 +1,6 @@ package com.google.refine.exporters; import java.io.IOException; -import java.io.OutputStream; import java.io.Writer; import java.util.Properties; @@ -15,25 +14,19 @@ import com.google.refine.model.Project; import com.google.refine.model.Row; public class HtmlTableExporter implements WriterExporter { + + @Override public String getContentType() { return "text/html"; } - - public boolean takeWriter() { - return true; - } - - public void export(Project project, Properties options, Engine engine, - OutputStream outputStream) throws IOException { - throw new RuntimeException("Not implemented"); - } - + + @Override public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException { writer.write("\n"); writer.write(""); - writer.write(ProjectManager.singleton.getProjectMetadata(project.id).getName()); - writer.write("\n"); - + writer.write(ProjectManager.singleton.getProjectMetadata(project.id).getName()); + writer.write("\n"); + writer.write("\n"); writer.write("\n"); diff --git a/main/src/com/google/refine/exporters/TemplatingExporter.java b/main/src/com/google/refine/exporters/TemplatingExporter.java index 69688388e..f62e74df1 100644 --- a/main/src/com/google/refine/exporters/TemplatingExporter.java +++ b/main/src/com/google/refine/exporters/TemplatingExporter.java @@ -1,7 +1,6 @@ package com.google.refine.exporters; import java.io.IOException; -import java.io.OutputStream; import java.io.StringWriter; import java.io.Writer; import java.util.Properties; @@ -11,11 +10,11 @@ import org.json.JSONObject; import org.json.JSONWriter; import com.google.refine.browsing.Engine; +import com.google.refine.browsing.Engine.Mode; import com.google.refine.browsing.FilteredRecords; import com.google.refine.browsing.FilteredRows; import com.google.refine.browsing.RecordVisitor; import com.google.refine.browsing.RowVisitor; -import com.google.refine.browsing.Engine.Mode; import com.google.refine.expr.ParsingException; import com.google.refine.model.Project; import com.google.refine.sorting.SortingRecordVisitor; @@ -25,19 +24,13 @@ import com.google.refine.templating.Template; import com.google.refine.util.ParsingUtilities; public class TemplatingExporter implements WriterExporter { + + @Override public String getContentType() { return "application/x-unknown"; } - - public boolean takeWriter() { - return true; - } - - public void export(Project project, Properties options, Engine engine, - OutputStream outputStream) throws IOException { - throw new RuntimeException("Not implemented"); - } - + + @Override public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException { String limitString = options.getProperty("limit"); int limit = limitString != null ? Integer.parseInt(limitString) : -1; diff --git a/main/src/com/google/refine/exporters/XlsExporter.java b/main/src/com/google/refine/exporters/XlsExporter.java index 3af9570b0..c78a44f30 100644 --- a/main/src/com/google/refine/exporters/XlsExporter.java +++ b/main/src/com/google/refine/exporters/XlsExporter.java @@ -2,7 +2,6 @@ package com.google.refine.exporters; import java.io.IOException; import java.io.OutputStream; -import java.io.Writer; import java.util.Calendar; import java.util.Date; import java.util.Properties; @@ -22,21 +21,16 @@ import com.google.refine.model.Project; import com.google.refine.model.Row; public class XlsExporter implements StreamExporter { + + @Override public String getContentType() { return "application/xls"; } - - public boolean takeWriter() { - return false; - } - - public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException { - throw new RuntimeException("Not implemented"); - } - + + @Override public void export(Project project, Properties options, Engine engine, - OutputStream outputStream) throws IOException { - + OutputStream outputStream) throws IOException { + Workbook wb = new HSSFWorkbook(); Sheet s = wb.createSheet(); wb.setSheetName(0, ProjectManager.singleton.getProjectMetadata(project.id).getName());