new Object[]{fileName, portfolioName, dataField, dataProvider});
if (!(fileEntity instanceof BodyPartEntity)) {
throw new WebApplicationException(Response.Status.BAD_REQUEST);
}
final ResolvingPortfolioCopier copier = new ResolvingPortfolioCopier(_historicalTimeSeriesMaster,
_historicalTimeSeriesProvider,
_referenceDataProvider,
dataProvider,
dataFields);
final PortfolioWriter portfolioWriter =
new MasterPortfolioWriter(portfolioName, _portfolioMaster, _positionMaster, _securityMaster, false, false, true);
SheetFormat format = getFormatForFileName(fileName);
RowParser rowParser = new ExchangeTradedRowParser(_securityProvider);
final PortfolioReader portfolioReader = new SingleSheetSimplePortfolioReader(format, fileStream, rowParser);
StreamingOutput streamingOutput = new StreamingOutput() {
@Override
public void write(OutputStream output) throws IOException, WebApplicationException {
// TODO callback for progress updates as portoflio is copied
copier.copy(portfolioReader, portfolioWriter);
output.write("Upload complete".getBytes());
}
};
return Response.ok(streamingOutput).build();
}