use of com.ramussoft.idef0.attribute.SectorBorderPersistent 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.idef0.attribute.SectorBorderPersistent in project ramus by Vitaliy-Yakovchuk.
the class NSectorBorder method getAFunction.
/**
* @return the function
*/
protected Function getAFunction() {
SectorBorderPersistent p = getSbp();
if (p.getFunction() < 0l)
return null;
if (function == null) {
function = (NFunction) dataPlugin.findRowByGlobalId(p.getFunction());
return function;
}
if (function.getElementId() == p.getFunction())
return function;
function = null;
return getAFunction();
}
Aggregations