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;
}
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;
}
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);
}
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;
}
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);
}
Aggregations