Created
January 9, 2012 22:07
-
-
Save muuki88/1585224 to your computer and use it in GitHub Desktop.
IReportingService draft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.lmu.ifi.dbs.medmon.medic.core.service; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.nio.file.Path; | |
import java.util.Map; | |
public interface IReportingService { | |
//TODO Maybe one more parameter to determine if the report should be rendered as html, pdf, etc | |
/** | |
* | |
* @param reportDocument | |
* @param reportOutput | |
*/ | |
public void renderReport(InputStream reportDocument, OutputStream reportOutput); | |
//TODO Maybe one more parameter to determine if the report should be rendered as html, pdf, etc | |
/** | |
* | |
* @param reportDesign - InputStream for reportDesign | |
* @param taskParameters - parameters to needed by the report, e.g. data or scheme files | |
* @param loader - to allocate the classes | |
* @param reportOutput - OutputStream where the report should be stored | |
*/ | |
public void renderReport(InputStream reportDesign, Map<String, Object> taskParameters, ClassLoader loader, Path reportOutput); | |
//TODO Maybe one more parameter to determine if the report should be rendered as html, pdf, etc | |
/** | |
* | |
* @param reportDesign | |
* @param taskParameters | |
* @param loader | |
* @param reportDocumentOutput | |
*/ | |
public void createReportDocument(InputStream reportDesign, Map<String, Object> taskParameters, ClassLoader loader, Path reportDocumentOutput); | |
} |
the createReportDocument
method should not use a java.nio.Path
argument. Instead use
OutputStream
to store the document and write it to a temporary file if necessary. E.g with
try {
Path tempFile = Files.createTempFile("prefix", "sufix");
System.out.println("Temp file " + tempFile);
try (BufferedWriter writer = Files.newBufferedWriter(tempFile, Charset.defaultCharset())) {
writer.write("Test string");
writer.newLine();
writer.write("Line 2");
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
try (BufferedReader reader = Files.newBufferedReader(tempFile, Charset.defaultCharset())) {
String first = reader.readLine();
System.out.println(first);
String second = reader.readLine();
System.out.println(second);
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
Files.deleteIfExists(tempFile);
} catch (IOException e) {
e.printStackTrace();
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Namingscheme for .xsd and .rptdesign idea:
medmon.medic.scheme.fileprefix