Search in sources :

Example 6 with Row

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

the class FastIdef0Connection method addAll.

private void addAll(Row function, IDEF0Buffer buffer) {
    for (Object child : function.getChildren()) {
        Row r = (Row) child;
        buffer.addFunctionStream(r);
        buffer.addRowFunction(r);
        addAll(r, buffer);
    }
}
Also used : Row(com.ramussoft.report.data.Row)

Example 7 with Row

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

the class IDEF0Buffer method commit.

public void commit(boolean all) {
    Enumeration<Row> keys = functionStreamsBuff.keys();
    while (keys.hasMoreElements()) {
        Row key = keys.nextElement();
        Hashtable<Row, Boolean> fs = functionStreamsBuff.get(key);
        Rows rows = new Rows(streams, data, false);
        functionStreams.put(key, rows);
        Enumeration<Row> streams = fs.keys();
        while (streams.hasMoreElements()) rows.add(streams.nextElement());
    }
    List<com.ramussoft.database.common.Row> allRows = this.functions.getAllRows();
    Row[] functions = allRows.toArray(new Row[allRows.size()]);
    keys = rowFunctionsBuff.keys();
    while (keys.hasMoreElements()) {
        Row key = keys.nextElement();
        Hashtable<Row, Boolean> rf = rowFunctionsBuff.get(key);
        Rows fns = new Rows(this.functions, data, false);
        // fns.addAll(rf.keySet());
        rowFunctions.put(key, fns);
        for (Row f : functions) if (all || getChildCount(f) == 0)
            if (rf.get(f) != null)
                fns.add(f);
    }
    functionStreamsBuff = null;
    rowFunctionsBuff = null;
}
Also used : Row(com.ramussoft.report.data.Row) Rows(com.ramussoft.report.data.Rows)

Example 8 with Row

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

the class IDEF0ConnectionPlugin method getStreams.

private Rows getStreams(Data data, String name) {
    final RowSet rowSet = IDEF0Buffer.getStreamsRowSet(data);
    final Rows rows = new Rows(rowSet, data, false);
    rows.setQualifierName(name);
    data.getTemplate().queryWithoutResults("SELECT DISTINCT ramus_attribute_any_to_any_elements.element_id,\n" + "(SELECT element_id FROM ramus_elements WHERE ramus_attribute_any_to_any_elements.other_element= ramus_elements.element_id) as oelement_id,\n" + "ramus_elements.element_name\n" + "FROM ramus_attribute_any_to_any_elements, ramus_elements, ramus_attribute_sector_borders, ramus_attribute_other_elements\n" + "WHERE ramus_attribute_any_to_any_elements.element_id= ramus_elements.element_id\n" + "AND ramus_attribute_sector_borders.function_type>=0\n" + "AND ramus_attribute_sector_borders.element_id = ramus_attribute_other_elements.element_id\n" + "AND ramus_attribute_other_elements.other_element = ramus_elements.element_id\n", new RowMapper() {

        @Override
        public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
            if ((rs.getString(3).length() > 0) || (rs.getObject(2) != null)) {
                rows.add((Row) rowSet.findRow(rs.getLong(1)));
            }
            return null;
        }
    }, true);
    return rows;
}
Also used : SQLException(java.sql.SQLException) RowSet(com.ramussoft.report.data.RowSet) ResultSet(java.sql.ResultSet) Row(com.ramussoft.report.data.Row) Rows(com.ramussoft.report.data.Rows) RowMapper(com.ramussoft.jdbc.RowMapper)

Example 9 with Row

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

the class IDEF0Connection method getRecIDEF0Kod.

protected String getRecIDEF0Kod(final Row function) {
    final Row f = (Row) function.getParent();
    if (f == null || f.getParent() == null)
        return "";
    String id = Integer.toString(function.getId());
    if (id.length() > 1)
        id = "." + id + ".";
    return getRecIDEF0Kod(f) + id;
}
Also used : Row(com.ramussoft.report.data.Row)

Example 10 with Row

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

the class QualifiersConnection method getConnected.

@SuppressWarnings("unchecked")
@Override
public Rows getConnected(Data data, Row row) {
    if (!(row.getQualifier().equals(IDEF0Plugin.getBaseStreamQualifier(data.getEngine()))))
        return new Rows(null, data, false);
    List<AnyToAnyPersistent> list = (List) row.getAttribute(IDEF0Plugin.getStreamAddedAttribute(data.getEngine()));
    final Engine engine = data.getEngine();
    Rows rows = new Rows(null, data, false) {

        /**
         */
        private static final long serialVersionUID = -284240974188065028L;

        @Override
        public RowSet getRowSet() {
            Row current = getCurrent();
            if (current == null)
                return null;
            return current.getRowSet();
        }

        @Override
        public Row addRow(long elementId) {
            long qId = engine.getQualifierIdForElement(elementId);
            if (qId >= 0l) {
                Qualifier qualifier = this.data.getQualifier(qId);
                if (qualifier != null) {
                    RowSet rowSet = this.data.getRowSet(qualifier);
                    Row row = (Row) rowSet.findRow(elementId);
                    if (row != null) {
                        add(row);
                        return row;
                    }
                }
            }
            return null;
        }
    };
    for (AnyToAnyPersistent p : list) {
        Row row2 = rows.addRow(p.getOtherElement());
        if (row2 != null)
            row2.setElementStatus(p.getElementStatus());
    }
    return rows;
}
Also used : RowSet(com.ramussoft.report.data.RowSet) List(java.util.List) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.report.data.Row) AnyToAnyPersistent(com.ramussoft.idef0.attribute.AnyToAnyPersistent) Engine(com.ramussoft.common.Engine) Rows(com.ramussoft.report.data.Rows)

Aggregations

Row (com.ramussoft.report.data.Row)19 Rows (com.ramussoft.report.data.Rows)9 AnyToAnyPersistent (com.ramussoft.idef0.attribute.AnyToAnyPersistent)6 ArrayList (java.util.ArrayList)6 List (java.util.List)6 RowSet (com.ramussoft.report.data.RowSet)5 Engine (com.ramussoft.common.Engine)4 Attribute (com.ramussoft.common.Attribute)3 RowMapper (com.ramussoft.jdbc.RowMapper)3 ResultSet (java.sql.ResultSet)3 SQLException (java.sql.SQLException)3 Qualifier (com.ramussoft.common.Qualifier)2 DataException (com.ramussoft.report.data.DataException)2 Hashtable (java.util.Hashtable)2 Element (com.ramussoft.common.Element)1 SectorBorderPersistent (com.ramussoft.idef0.attribute.SectorBorderPersistent)1 XMLReportEngine (com.ramussoft.report.XMLReportEngine)1 IOException (java.io.IOException)1 InvalidPropertiesFormatException (java.util.InvalidPropertiesFormatException)1