// Identify the correct portfolio writer for this security
String className = security.getClass().toString();
className = className.substring(className.lastIndexOf('.') + 1).replace("Security", "");
_currentWriter = _writerMap.get(className);
RowParser parser;
// create writer/output buffer map entry if not there for this security type
if (_currentWriter == null) {
s_logger.info("Creating a new row parser for " + className + " securities");
parser = JodaBeanRowParser.newJodaBeanRowParser(className);
if (parser == null) {
return null;
}
Map<String, RowParser> parserMap = new HashMap<String, RowParser>();
parserMap.put(className, parser);
ByteArrayOutputStream out = new ByteArrayOutputStream();
SheetWriter sheet = new CsvSheetWriter(out, parser.getColumns());
_currentWriter = new SingleSheetMultiParserPortfolioWriter(sheet, parserMap, _includeTrades);
_writerMap.put(className, _currentWriter);
_bufferMap.put(className, out);
_versionMap.put(className, parser.getSecurityHashCode());
}
return _currentWriter;
}