use of com.ramussoft.report.xml.NoRowsException in project ramus by Vitaliy-Yakovchuk.
the class XMLReportEngine method execute.
@Override
public void execute(String path, OutputStream stream, Map<String, Object> parameters) throws IOException {
createOut(stream);
Query query = (Query) parameters.get("query");
this.data = new Data(engine, query);
try {
final SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser;
parser = factory.newSAXParser();
byte[] bs = engine.getStream(path);
if (bs == null)
throw new DataException("Error.reportEmpty", "Report's form is empty");
do {
try {
parser.parse(new ByteArrayInputStream(bs), new ReportHandler());
} catch (NoRowsException e) {
break;
}
if (null == data.getBaseRows())
break;
connectedLabels.clear();
if (data.isSameBaseQualifier())
break;
} while (data.getBaseRows().next() != null);
} catch (ParserConfigurationException e) {
throw new DataException(e);
} catch (SAXException e) {
throw new DataException(e);
}
if (out.checkError())
throw new IOException();
out.flush();
out.realWrite();
}
use of com.ramussoft.report.xml.NoRowsException in project ramus by Vitaliy-Yakovchuk.
the class Data method getBaseRowByQualifier.
public Row getBaseRowByQualifier(String baseQualifierName) {
if (baseRows == null) {
baseRows = getRows(baseQualifierName);
if (query != null) {
List<Element> elements = query.getElements();
if (elements != null) {
for (int i = baseRows.size() - 1; i >= 0; i--) {
Row row = baseRows.get(i);
if (elements.indexOf(row.getElement()) < 0)
baseRows.remove(i);
}
}
}
if (baseRows.size() == 0)
throw new NoRowsException();
baseRows.next();
} else {
if (!baseQualifierName.equals(baseRows.getQualifierName())) {
throw new DataException("Error.differentBaseQualifiers", "Report contains diffetents base qualifiers in queries", baseQualifierName, baseRows.getQualifierName());
}
}
return baseRows.getCurrent();
}
Aggregations