use of org.nextprot.api.web.NXVelocityContext in project nextprot-api by calipho-sib.
the class WebUnitBaseTest method getVelocityOutput.
protected String getVelocityOutput(Entry entry) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
Writer writer = new PrintWriter(out);
NXVelocityContext context = new NXVelocityContext(entry);
Template template = velocityConfig.getVelocityEngine().getTemplate("entry.xml.vm");
template.merge(context, writer);
writer.flush();
return out.toString();
}
use of org.nextprot.api.web.NXVelocityContext in project nextprot-api by calipho-sib.
the class EntryXMLStreamWriter method writeFooter.
@Override
protected void writeFooter() throws IOException {
Template exportTemplate = velocityConfig.getVelocityEngine().getTemplate("export-footer.xml.vm");
exportTemplate.merge(new NXVelocityContext(), getStream());
}
use of org.nextprot.api.web.NXVelocityContext in project nextprot-api by calipho-sib.
the class EntryTTLStreamWriter method writeHeader.
@Override
protected void writeHeader(Map<String, Object> infos) {
int entryNum = (int) infos.get(EntryStreamWriter.getEntryCountKey());
ReleaseInfoVersions releaseInfoVersions = (ReleaseInfoVersions) infos.get(EntryStreamWriter.getReleaseInfoKey());
Template headerTemplate = velocityConfig.getVelocityEngine().getTemplate("turtle/prefix.ttl.vm");
headerTemplate.merge(new NXVelocityContext(entryNum, releaseInfoVersions), getStream());
}
use of org.nextprot.api.web.NXVelocityContext in project nextprot-api by calipho-sib.
the class EntryXMLStreamWriter method writeHeader.
@Override
protected void writeHeader(Map<String, Object> infos) throws IOException {
int entryNum = (int) infos.get(EntryStreamWriter.getEntryCountKey());
ReleaseInfoVersions releaseInfoVersions = (ReleaseInfoVersions) infos.get(EntryStreamWriter.getReleaseInfoKey());
ReleaseInfoDataSources releaseInfoDataSources = (ReleaseInfoDataSources) infos.get(EntryStreamWriter.getReleaseDataSourcesKey());
Template headerTemplate = velocityConfig.getVelocityEngine().getTemplate("export-header.xml.vm");
headerTemplate.merge(new NXVelocityContext(entryNum, releaseInfoVersions), getStream());
Template releaseContentTemplate = velocityConfig.getVelocityEngine().getTemplate("release-contents.xml.vm");
writePrettyXml(releaseContentTemplate, new NXVelocityContext(entryNum, releaseInfoVersions, releaseInfoDataSources), 2);
getStream().write(" </header>\n");
getStream().write(" <entry-list>\n");
}
use of org.nextprot.api.web.NXVelocityContext in project nextprot-api by calipho-sib.
the class EntryTTLValidationIntegrationTest method addTurtlePrefixes.
static void addTurtlePrefixes(Writer writer, VelocityConfig config) {
Template headerTemplate = config.getVelocityEngine().getTemplate("turtle/prefix.ttl.vm");
headerTemplate.merge(new NXVelocityContext(), writer);
}
Aggregations