use of org.stringtemplate.v4.STGroupFile in project archi by archimatetool.
the class HTMLReportExporter method createReport.
public File createReport(File targetFolder, String indexFileName) throws IOException {
// Copy HTML skeleton to target
copyHTMLSkeleton(targetFolder);
// Copy hints files from the help plug-in
copyHintsFiles(targetFolder);
// Create sub-folders
// $NON-NLS-1$
File elementsFolder = new File(targetFolder, fModel.getId() + "/elements");
// Make dir
elementsFolder.mkdirs();
// $NON-NLS-1$
File viewsFolder = new File(targetFolder, fModel.getId() + "/views");
// Make dir
viewsFolder.mkdirs();
// $NON-NLS-1$
File imagesFolder = new File(targetFolder, fModel.getId() + "/images");
// Make dir
imagesFolder.mkdirs();
// Instantiate templates files
// $NON-NLS-1$
File mainFile = new File(ArchiReportsPlugin.INSTANCE.getTemplatesFolder(), "st/main.stg");
STGroupFile groupFile = new STGroupFile(mainFile.getAbsolutePath(), '^', '^');
// $NON-NLS-1$
ST stFrame = groupFile.getInstanceOf("frame");
groupFile.registerRenderer(String.class, new StringRenderer());
// Write model purpose and properties html
// $NON-NLS-1$
writeElement(new File(elementsFolder, "model.html"), stFrame, fModel);
// Write all folders
writeFolders(elementsFolder, stFrame, fModel.getFolders());
// Write Diagrams and images
writeDiagrams(imagesFolder, viewsFolder, stFrame);
// Write root model.html frame
File indexFile = new File(targetFolder, indexFileName);
// $NON-NLS-1$
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(indexFile), "UTF8");
// $NON-NLS-1$
ST stModel = groupFile.getInstanceOf("modelreport");
// $NON-NLS-1$
stModel.add("model", fModel);
// $NON-NLS-1$
stModel.add("strategyFolder", fModel.getFolder(FolderType.STRATEGY));
// $NON-NLS-1$
stModel.add("businessFolder", fModel.getFolder(FolderType.BUSINESS));
// $NON-NLS-1$
stModel.add("applicationFolder", fModel.getFolder(FolderType.APPLICATION));
// $NON-NLS-1$
stModel.add("technologyFolder", fModel.getFolder(FolderType.TECHNOLOGY));
// $NON-NLS-1$
stModel.add("motivationFolder", fModel.getFolder(FolderType.MOTIVATION));
// $NON-NLS-1$
stModel.add("implementationFolder", fModel.getFolder(FolderType.IMPLEMENTATION_MIGRATION));
// $NON-NLS-1$
stModel.add("otherFolder", fModel.getFolder(FolderType.OTHER));
// $NON-NLS-1$
stModel.add("relationsFolder", fModel.getFolder(FolderType.RELATIONS));
// $NON-NLS-1$
stModel.add("viewsFolder", fModel.getFolder(FolderType.DIAGRAMS));
writer.write(stModel.render());
writer.close();
return indexFile;
}
use of org.stringtemplate.v4.STGroupFile in project webcert by sklintyg.
the class ReceiveMedicalCertificateAnswerIT method setup.
@Before
public void setup() throws IOException {
// Setup String template resource
templateGroup = new STGroupFile("integrationtestTemplates/receiveMedicalCertificateAnswer.v1.stg");
requestTemplate = templateGroup.getInstanceOf("request");
xsdInputstream = ClasspathSchemaResourceResolver.load("interactions/ReceiveMedicalCertificateAnswerInteraction/ReceiveMedicalCertificateAnswerResponder_1.0.xsd");
// We want to validate against the body of the response, and not the entire soap response. This filter will
// extract that for us.
responseBodyExtractorFilter = new BodyExtractorFilter(ImmutableMap.of("lc", "urn:riv:insuranceprocess:healthreporting:ReceiveMedicalCertificateAnswerResponder:1"), "soap:Envelope/soap:Body/lc:ReceiveMedicalCertificateAnswerResponse");
}
use of org.stringtemplate.v4.STGroupFile in project webcert by sklintyg.
the class ReceiveMedicalCertificateQuestionIT method setup.
@Before
public void setup() throws IOException {
// Setup String template resource
templateGroup = new STGroupFile("integrationtestTemplates/receiveMedicalCertificateQuestion.v1.stg");
requestTemplate = templateGroup.getInstanceOf("request");
xsdInputstream = ClasspathSchemaResourceResolver.load("interactions/ReceiveMedicalCertificateQuestionInteraction/ReceiveMedicalCertificateQuestionResponder_1.0.xsd");
// We want to validate against the body of the response, and not the entire soap response. This filter will
// extract that for us.
responseBodyExtractorFilter = new BodyExtractorFilter(ImmutableMap.of("lc", "urn:riv:insuranceprocess:healthreporting:ReceiveMedicalCertificateQuestionResponder:1"), "soap:Envelope/soap:Body/lc:ReceiveMedicalCertificateQuestionResponse");
}
use of org.stringtemplate.v4.STGroupFile in project webcert by sklintyg.
the class CreateDraftCertificateV1IT method setup.
@Before
public void setup() throws IOException {
// Setup String template resource
templateGroup = new STGroupFile("integrationtestTemplates/createDraftCertificate.v1.stg");
requestTemplate = templateGroup.getInstanceOf("request");
xsdInputstream = ClasspathSchemaResourceResolver.load("interactions/CreateDraftCertificateInteraction/CreateDraftCertificateResponder_1.0.xsd");
// We want to validate against the body of the response, and not the entire soap response. This filter will
// extract that for us.
responseBodyExtractorFilter = new BodyExtractorFilter(ImmutableMap.of("lc", "urn:riv:clinicalprocess:healthcond:certificate:CreateDraftCertificateResponder:1"), "soap:Envelope/soap:Body/lc:CreateDraftCertificateResponse");
// Make a dummy request, ignore response...
given().get("/services").then().statusCode(greaterThan(199));
}
use of org.stringtemplate.v4.STGroupFile in project webcert by sklintyg.
the class CreateDraftCertificateV3IT method setup.
@Before
public void setup() throws IOException {
// Setup String template resource
templateGroup = new STGroupFile("integrationtestTemplates/createDraftCertificate.v3.stg");
requestTemplate = templateGroup.getInstanceOf("request");
xsdInputstream = ClasspathSchemaResourceResolver.load("interactions/CreateDraftCertificateInteraction/CreateDraftCertificateResponder_3.1.xsd");
// We want to validate against the body of the response, and not the entire soap response. This filter will
// extract that for us.
responseBodyExtractorFilter = new BodyExtractorFilter(ImmutableMap.of("lc", "urn:riv:clinicalprocess:healthcond:certificate:CreateDraftCertificateResponder:3"), "soap:Envelope/soap:Body/lc:CreateDraftCertificateResponse");
}
Aggregations