Search in sources :

Example 11 with Rows

use of com.ramussoft.report.data.Rows 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)

Example 12 with Rows

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

the class FastIdef0Connection method getConnected.

@Override
public Rows getConnected(Data data, Row row) {
    branchId = data.getBranchId();
    String modelName = data.getQuery().getAttribute("ReportFunction");
    if (modelName == null)
        throw new DataException("Error.noModelProperty", "Set model attribute for report first!!!");
    List<Qualifier> models = getQualifiers(data, modelName);
    Rows res = null;
    for (Qualifier model : models) {
        Key key = new Key(all, model);
        IDEF0Buffer[] buffer = getIDEF0Buffers(key, data);
        Rows rows;
        if (row.getElement().getQualifierId() == model.getId()) {
            rows = buffer[type].getStreams(row);
        } else {
            rows = buffer[type].getFunctions(row);
        }
        if (res == null)
            res = rows;
        else
            res.addAll(rows);
    }
    if (res == null)
        throw new DataException("Error.noModelProperty", "Set model attribute for report first!!!");
    return res;
}
Also used : DataException(com.ramussoft.report.data.DataException) Qualifier(com.ramussoft.common.Qualifier) Rows(com.ramussoft.report.data.Rows)

Example 13 with Rows

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

the class InputsControlsConnection method getConnected.

@Override
public Rows getConnected(Data data, Row row) {
    Rows rows = inputs.getConnected(data, row);
    rows.addAll(controls.getConnected(data, row));
    return rows;
}
Also used : Rows(com.ramussoft.report.data.Rows)

Example 14 with Rows

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

the class OwnersConnection method getOuners.

private Rows getOuners(Data data, Row row) {
    List<Row> ouner = owners.get(row);
    if (ouner != null && ouner.size() > 0) {
        Rows rows = new Rows(ouner.get(0).getRowSet(), data, false, 1);
        rows.addAll(ouner);
        return rows;
    }
    return new Rows(null, data, false, 0);
}
Also used : Row(com.ramussoft.report.data.Row) Rows(com.ramussoft.report.data.Rows)

Example 15 with Rows

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

the class RolesConnection method getRoles.

private Rows getRoles(Data data, Row row) {
    List<Row> rRows = roles.get(row);
    if (rRows != null && rRows.size() > 0) {
        Rows rows = new Rows(rRows.get(0).getRowSet(), data, false, 1);
        rows.addAll(rRows);
        return rows;
    }
    return new Rows(null, data, false, 0);
}
Also used : Row(com.ramussoft.report.data.Row) Rows(com.ramussoft.report.data.Rows)

Aggregations

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