Skip to content
Snippets Groups Projects
Commit 48304a52 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

* fixes for resource handler, correct bundle name and template path, and formatting offsets

parent 61c0ba9f
No related branches found
No related tags found
No related merge requests found
Pipeline #2678 passed
......@@ -53,7 +53,7 @@ import org.osgi.framework.Bundle;
public class Generator {
int index = 0;
String templateFilename = "template.docx";
String templateFilename = "resource/template.docx";
public static String selectedTemplate = "TO_4_TABLE_TEMPLATE_EDITHELP";
XWPFDocument template;
private boolean hierarchical = true;
......@@ -295,7 +295,7 @@ public class Generator {
}
private XWPFDocument loadTemplate() throws Exception {
URI templateLocation = ResourceHandler.getSourceUri(this.getClass(), "org.etsi.mts.tdl.to.docx.poi", templateFilename);
URI templateLocation = ResourceHandler.getSourceUri(this.getClass(), "org.etsi.mts.tdl.tools.to.docx.poi", templateFilename);
template = loadTemplateDocument(templateLocation);
return template;
}
......@@ -477,7 +477,9 @@ public class Generator {
String then = NodeModelUtils.getNode(expectedBehaviours.get(1)).getText();
//TODO: a bit of a hack
when = filterSource(when, "\n", "\\s\\s\\s\\s\\w");
then = filterSource(then, "\n", "\\s+\\w");
//then = filterSource(then, "\n", "\\s+\\w");
//then = filterSource(then, "\n", "\\s+\\w");
then = filterSource(then, "\n", "\\s\\s\\s\\s\\w");
map.put(Placeholders.WHEN, "when {"+when+"\n}");
map.put(Placeholders.THEN, "then {"+then+"\n}");
......@@ -557,7 +559,8 @@ public class Generator {
String then = NodeModelUtils.getNode(sto.getExpectedBehaviour().getThenClause()).getText();
//TODO: a bit of a hack
when = filterSource(when, "\n", "\\s\\s\\s\\s\\w");
then = filterSource(then, "\n", "\\s+\\w");
//then = filterSource(then, "\n", "\\s+\\w");
then = filterSource(then, "\n", "\\s\\s\\s\\s\\w");
map.put(Placeholders.WHEN, "when {"+when+"\n}");
map.put(Placeholders.THEN, "then {"+then+"\n}");
......@@ -625,8 +628,7 @@ public class Generator {
}
private XWPFDocument loadTemplateDocument(URI templateLocation) throws Exception {
File file = new File(templateLocation);
FileInputStream fis = new FileInputStream(file.getAbsolutePath());
FileInputStream fis = (FileInputStream) templateLocation.toURL().openStream();
XWPFDocument document = new XWPFDocument(fis);
fis.close();
return document;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment