use of org.nextprot.api.core.domain.release.ReleaseInfoVersions in project nextprot-api by calipho-sib.
the class ReleaseInfoServiceImpl method findReleaseVersions.
@Override
@Cacheable("release-versions")
public ReleaseInfoVersions findReleaseVersions() {
ReleaseInfoVersions ri = new ReleaseInfoVersions();
ri.setDatabaseRelease(releaseInfoDao.findDatabaseRelease());
ri.setApiRelease(this.getApiVersion());
return ri;
}
use of org.nextprot.api.core.domain.release.ReleaseInfoVersions in project nextprot-api by calipho-sib.
the class ExportXMLHeaderTest method testXMLExportHeaderRelease.
@Test
public void testXMLExportHeaderRelease() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
Writer writer = new PrintWriter(out);
EntryVelocityBasedStreamWriter exporter = new EntryXMLStreamWriter(writer, "overview");
ReleaseInfoVersions rc = new ReleaseInfoVersions();
rc.setApiRelease("api-test-version");
rc.setDatabaseRelease("database-test-version");
Map<String, Object> infos = new HashMap<>();
infos.put(EntryStreamWriter.getReleaseInfoKey(), rc);
exporter.write(Collections.emptyList(), infos);
NodeList dbReleaseNodes = XMLUnitUtils.getMatchingNodes(out.toString(), "//*[local-name()='database-release']");
assertEquals("database-test-version", dbReleaseNodes.item(0).getTextContent());
NodeList apiReleaseNodes = XMLUnitUtils.getMatchingNodes(out.toString(), "//*[local-name()='api-release']");
assertEquals("api-test-version", apiReleaseNodes.item(0).getTextContent());
NodeList entriesCountNode = XMLUnitUtils.getMatchingNodes(out.toString(), "//*[local-name()='number-of-entries']");
assertEquals("0", entriesCountNode.item(0).getTextContent());
}
use of org.nextprot.api.core.domain.release.ReleaseInfoVersions 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.core.domain.release.ReleaseInfoVersions 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");
}
Aggregations