Search in sources :

Example 1 with Query

use of com.ramussoft.report.Query in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method printReport.

private void printReport(final String string) throws IOException {
    final long num = Long.parseLong(string);
    Element report = null;
    report = dataPlugin.getEngine().getElement(num);
    if (report == null) {
        printError(RES.getString("reportEror"));
        return;
    }
    htmlTitle = report.getName();
    printStartD();
    Query query = null;
    Qualifier qualifier = ((ReportQuery) dataPlugin.getEngine()).getHTMLReportQuery(report);
    if (qualifier != null) {
        query = new Query(null);
        List<Element> elements = new ArrayList<Element>();
        for (Row row : getSelRows(qualifier)) {
            elements.add(row.getElement());
        }
        query.setElements(elements);
    }
    printReport(report, query);
    printEndD();
}
Also used : ReportQuery(com.ramussoft.report.ReportQuery) Query(com.ramussoft.report.Query) ReportQuery(com.ramussoft.report.ReportQuery) Element(com.ramussoft.common.Element) ArrayList(java.util.ArrayList) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.pb.Row) NRow(com.ramussoft.pb.data.negine.NRow)

Example 2 with Query

use of com.ramussoft.report.Query in project ramus by Vitaliy-Yakovchuk.

the class QueryView method getQuery.

public Query getQuery() {
    if (selectableTableView == null)
        return null;
    Query query = new Query(new HashMap<String, String>(0));
    List<Row> rows = selectableTableView.getSelectedRows();
    ArrayList<Element> elements = new ArrayList<Element>(rows.size());
    for (Row row : rows) elements.add(row.getElement());
    query.setElements(elements);
    return query;
}
Also used : ReportQuery(com.ramussoft.report.ReportQuery) Query(com.ramussoft.report.Query) Element(com.ramussoft.common.Element) ArrayList(java.util.ArrayList) Row(com.ramussoft.database.common.Row)

Example 3 with Query

use of com.ramussoft.report.Query in project ramus by Vitaliy-Yakovchuk.

the class ReportEditorView method getHTMLText.

protected String getHTMLText() {
    String page;
    try {
        HashMap<String, Object> map = new HashMap<String, Object>();
        Query query = queryView.getQuery();
        if (query != null)
            map.put("query", query);
        page = ((ReportQuery) framework.getEngine()).getHTMLReport(element, map);
    } catch (Exception e1) {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        PrintStream s = new PrintStream(stream);
        e1.printStackTrace();
        if (e1 instanceof DataException)
            s.println(((DataException) e1).getMessage(new MessageFormatter() {

                @Override
                public String getString(String key, Object[] arguments) {
                    return MessageFormat.format(ReportResourceManager.getString(key), arguments);
                }
            }));
        else {
            e1.printStackTrace(s);
        }
        s.flush();
        page = new String(stream.toByteArray());
    }
    return page;
}
Also used : PrintStream(java.io.PrintStream) DataException(com.ramussoft.report.data.DataException) ReportQuery(com.ramussoft.report.ReportQuery) Query(com.ramussoft.report.Query) HashMap(java.util.HashMap) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MessageFormatter(com.ramussoft.report.data.MessageFormatter) DataException(com.ramussoft.report.data.DataException) PrinterException(java.awt.print.PrinterException)

Aggregations

Query (com.ramussoft.report.Query)3 ReportQuery (com.ramussoft.report.ReportQuery)3 Element (com.ramussoft.common.Element)2 ArrayList (java.util.ArrayList)2 Qualifier (com.ramussoft.common.Qualifier)1 Row (com.ramussoft.database.common.Row)1 Row (com.ramussoft.pb.Row)1 NRow (com.ramussoft.pb.data.negine.NRow)1 DataException (com.ramussoft.report.data.DataException)1 MessageFormatter (com.ramussoft.report.data.MessageFormatter)1 PrinterException (java.awt.print.PrinterException)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1 HashMap (java.util.HashMap)1