use of ambit2.db.reporters.xlsx.StructureRecordXLSXReporter in project ambit-mirror by ideaconsult.
the class SubstanceDatasetResource method createXLSXReporter.
protected IProcessor<Q, Representation> createXLSXReporter(MediaType media, boolean hssf, String filenamePrefix) {
groupProperties.add(new SubstancePublicName());
groupProperties.add(new SubstanceName());
groupProperties.add(new SubstanceUUID());
groupProperties.add(new SubstanceOwner());
String jsonpcallback = getParams().getFirstValue("jsonp");
if (jsonpcallback == null)
jsonpcallback = getParams().getFirstValue("callback");
String configResource = String.format("config-%s.js", ((IFreeMarkerApplication) getApplication()).getProfile());
return new OutputStreamConvertor(new StructureRecordXLSXReporter(getRequest().getRootRef().toString(), hssf, getTemplate(), getGroupProperties(), getBundles(), null, true, configResource) {
@Override
protected void configurePropertyProcessors() {
getCompositionProcessors(getProcessors());
getProcessors().add(getPropertyProcessors(false, false));
}
@Override
protected void initColumns(int afterCol) {
for (I5_ROOT_OBJECTS section : I5_ROOT_OBJECTS.values()) {
if (section.isIUCLID5() && section.isScientificPart() && section.isSupported() && !section.isNanoMaterialTemplate()) {
int last = mergedProperties.size();
mergedProperties.put("http://www.opentox.org/echaEndpoints.owl#" + section.name(), last);
Cell hcell = sheet.getRow(0).createCell(last + afterCol);
hcell.setCellStyle(hstyle);
hcell.setCellType(CellType.STRING);
hcell.setCellValue(section.getNumber() + ". " + section.getTitle());
sheet.autoSizeColumn(hcell.getColumnIndex(), true);
// initially hide all columns, unhide if data is added
// to
sheet.setColumnHidden(hcell.getColumnIndex(), true);
}
}
}
}, media, filenamePrefix);
}
Aggregations