use of cern.modesti.request.upload.exception.RequestParseException in project modesti by jlsalmon.
the class RequestParserFactory method parseRequest.
/**
* Parse the given Excel sheet as a {@link Request} instance.
*
* @param stream the Excel sheet input stream
* @return the result of the parse operation
*/
public RequestParseResult parseRequest(InputStream stream) {
Sheet sheet = getSheet(stream);
Row header = sheet.getRow(0);
String pluginId = header.getCell(0).getStringCellValue().trim();
RequestParser parser = getPluginRequestParser(pluginId);
if (parser == null) {
throw new UnsupportedRequestException("No parser found for domain " + pluginId);
}
RequestParseResult result = parser.parseRequest(sheet);
if (result.getRequest().getPoints().isEmpty()) {
throw new RequestParseException("Sheet contains no data points");
}
return result;
}
Aggregations