Search in sources :

Example 11 with Row

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

the class Stream method getAddedRows.

@SuppressWarnings("unchecked")
public List<Row> getAddedRows() {
    if (addedRows == null) {
        Engine engine = data.getEngine();
        Attribute attribute = IDEF0Plugin.getStreamAddedAttribute(engine);
        List<AnyToAnyPersistent> list = (List) engine.getAttribute(element, attribute);
        addedRows = new ArrayList<Row>(list.size());
        for (AnyToAnyPersistent p : list) {
            Row row = data.findRow(p.getOtherElement());
            if (row != null) {
                row = row.createCopy();
                row.setElementStatus(p.getElementStatus());
                addedRows.add(row);
            }
        }
        Collections.sort(addedRows);
        StringBuffer buff = new StringBuffer();
        boolean first = true;
        for (Row row : addedRows) {
            if (first)
                first = false;
            else
                buff.append("; ");
            buff.append(row.getName());
        }
        rName = buff.toString();
    }
    return addedRows;
}
Also used : Attribute(com.ramussoft.common.Attribute) ArrayList(java.util.ArrayList) List(java.util.List) Row(com.ramussoft.report.data.Row) XMLReportEngine(com.ramussoft.report.XMLReportEngine) Engine(com.ramussoft.common.Engine) AnyToAnyPersistent(com.ramussoft.idef0.attribute.AnyToAnyPersistent)

Example 12 with Row

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

the class FastIdef0Connection method createBuffers.

private IDEF0Buffer[] createBuffers(final Key key, final Data data) {
    final IDEF0Buffer[] buffers = new IDEF0Buffer[4];
    for (int i = 0; i < 4; i++) buffers[i] = new IDEF0Buffer(data, key.model);
    RowSet model = data.getRowSet(key.model);
    RowSet base = data.getRowSet(IDEF0Plugin.getBaseFunctions(data.getEngine()));
    end = IDEF0Plugin.getSectorBorderEndAttribute(data.getEngine());
    start = IDEF0Plugin.getSectorBorderStartAttribute(data.getEngine());
    Attribute fun = IDEF0Plugin.getSectorFunctionAttribute(data.getEngine());
    Attribute st = IDEF0Plugin.getSectorStreamAttribute(data.getEngine());
    Attribute dType = IDEF0Plugin.getDecompositionTypeAttribute(data.getEngine());
    RowSet sectors = data.getRowSet(IDEF0Plugin.getBaseSectorQualifier(data.getEngine()));
    RowSet streams = data.getRowSet(IDEF0Plugin.getBaseStreamQualifier(data.getEngine()));
    Attribute anyToAnyAttribute = IDEF0Plugin.getStreamAddedAttribute(data.getEngine());
    for (com.ramussoft.database.common.Row sector : sectors.getAllRows()) {
        Long f = (Long) sector.getAttribute(fun);
        Long s = (Long) sector.getAttribute(st);
        if (f != null && s != null) {
            com.ramussoft.database.common.Row parentFunction = model.findRow(f);
            com.ramussoft.database.common.Row pFunction = null;
            if (parentFunction == null) {
                Qualifier q1 = base.getEngine().getQualifier(f);
                if (q1 != null)
                    System.out.println(q1);
                pFunction = base.findRow(f);
                if (pFunction != null && pFunction.getAttribute(IDEF0Plugin.getBaseFunctionQualifierId(data.getEngine())).equals(model.getQualifier().getId()))
                    parentFunction = pFunction;
            }
            Row stream = (Row) streams.findRow(s);
            if (parentFunction != null && stream != null) {
                Integer decompositionType = (Integer) parentFunction.getAttribute(dType);
                if (pFunction != null)
                    parentFunction = null;
                else if (parentFunction.getChildCount() == 0)
                    continue;
                List<AnyToAnyPersistent> list = (List) stream.getAttribute(anyToAnyAttribute);
                if (list == null)
                    list = Collections.emptyList();
                SectorBorderPersistent sb = (SectorBorderPersistent) sector.getAttribute(start);
                int type;
                if (sb != null && (type = sb.getFunctionType()) >= 0) {
                    if (decompositionType != null && decompositionType == 2) {
                        // DFDS
                        type = 0;
                    }
                    IDEF0Buffer buffer = buffers[type];
                    Row function = buffer.addFunctionStream(sb.getFunction(), stream.getElementId(), parentFunction);
                    for (AnyToAnyPersistent p : list) if (p != null) {
                        buffer.addRowFunction(p.getOtherElement(), sb.getFunction(), p.getElementStatus(), parentFunction);
                        if (sb.getTunnelSoft() == 1 && function != null && function.getChildCount() > 0) {
                            addAll(function, buffer);
                        }
                    }
                }
                sb = (SectorBorderPersistent) sector.getAttribute(end);
                if (sb != null && (type = sb.getFunctionType()) >= 0) {
                    if (decompositionType != null && decompositionType == 2) {
                        // DFDS
                        type = 2;
                    }
                    IDEF0Buffer buffer = buffers[type];
                    Row function = buffer.addFunctionStream(sb.getFunction(), stream.getElementId(), parentFunction);
                    for (AnyToAnyPersistent p : list) if (p != null) {
                        buffer.addRowFunction(p.getOtherElement(), sb.getFunction(), p.getElementStatus(), parentFunction);
                        if (sb.getTunnelSoft() == 1 && function != null && function.getChildCount() > 0) {
                            addAll(function, buffer);
                        }
                    }
                }
            }
        }
    }
    for (IDEF0Buffer buffer : buffers) buffer.commit(all);
    return buffers;
}
Also used : Attribute(com.ramussoft.common.Attribute) RowSet(com.ramussoft.report.data.RowSet) SectorBorderPersistent(com.ramussoft.idef0.attribute.SectorBorderPersistent) AnyToAnyPersistent(com.ramussoft.idef0.attribute.AnyToAnyPersistent) Qualifier(com.ramussoft.common.Qualifier) ArrayList(java.util.ArrayList) List(java.util.List) Row(com.ramussoft.report.data.Row)

Example 13 with Row

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

the class IDEF0Buffer method addRowFunction.

public void addRowFunction(long rowId, long functionId, String status, com.ramussoft.database.common.Row parent) {
    Row r = data.findRow(rowId);
    if (r == null)
        return;
    row = r.createCopy();
    row.setElementStatus(status);
    Row function = (Row) functions.findRow(functionId);
    if (function == null || row == null)
        return;
    if (parent != null && (function.getParent() == null || !function.getParent().equals(parent)))
        return;
    addRowFunction(row, function);
}
Also used : Row(com.ramussoft.report.data.Row)

Example 14 with Row

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

the class IDEF0Buffer method addFunctionStream.

public Row addFunctionStream(long functionId, long streamId, com.ramussoft.database.common.Row parent) {
    Row function = (Row) functions.findRow(functionId);
    stream = (Row) streams.findRow(streamId);
    if (function == null || stream == null)
        return null;
    if (parent != null && (function.getParent() == null || !function.getParent().equals(parent)))
        return null;
    addFunctionStream(function, stream);
    return function;
}
Also used : Row(com.ramussoft.report.data.Row)

Example 15 with Row

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

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