use of com.ramussoft.database.common.RowSet in project ramus by Vitaliy-Yakovchuk.
the class ReportQueryImpl method getHTMLReports.
@Override
public List<Element> getHTMLReports() {
RowSet rowSet = new RowSet(engine, ReportPlugin.getReportsQualifier(engine), new Attribute[] {}, null, true);
List<Row> rows = rowSet.getAllRows();
List<Element> elements = new ArrayList<Element>(rows.size());
for (Row row : rows) elements.add(row.getElement());
return elements;
}
use of com.ramussoft.database.common.RowSet in project ramus by Vitaliy-Yakovchuk.
the class RSFViewer2 method createQualifiersList.
private Component createQualifiersList() {
// Load tree with elements meta data standard system qualifier.
RowSet rowSet = new RowSet(engine, StandardAttributesPlugin.getQualifiersQualifier(engine), new Attribute[] {});
final JTree qualifiersTree = new JTree(new DefaultTreeModel(rowSet.getRoot()));
qualifiersTree.setRootVisible(false);
qualifiersTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
RowSet rowSet = null;
@Override
public void valueChanged(TreeSelectionEvent e) {
// Load elements of qualifier.
// We will load elements with RowSet class,
// you can also load elements with engne.getElements
// methods.
Object value = qualifiersTree.getSelectionPath().getLastPathComponent();
// Value is really a Row element.
if (value != null) {
if (rowSet != null) {
// If rowSet is opened, we
// should close it and free
// all listeners.
rowSet.close();
// Just in case :)
rowSet = null;
}
Row qualifierRow = (Row) value;
// Even you are not going to use any attribute,
// use RowSet(Engine, Qualifier Attribute[])
// constructor
// instead of RowSet(Engine, Qualifier) constructor.
rowSet = new RowSet(engine, StandardAttributesPlugin.getQualifier(engine, qualifierRow.getElement()), new Attribute[] {});
// And just load tree component with elements
// covered to Row objects.
tree.setModel(new DefaultTreeModel(rowSet.getRoot()));
}
}
});
JScrollPane pane = new JScrollPane();
pane.setViewportView(qualifiersTree);
return pane;
}
use of com.ramussoft.database.common.RowSet in project ramus by Vitaliy-Yakovchuk.
the class QualifierImporterImpl method createQualifier.
private Qualifier createQualifier(Qualifier sourceQualifier, Row row) {
Qualifier res = engine.getQualifierByName(sourceQualifier.getName());
if (res == null) {
Qualifier q = StandardAttributesPlugin.getQualifiersQualifier(engine);
RowSet rs = new RowSet(engine, q, new Attribute[] {});
Row parent = findParent(rs, row.getParent());
if ((parent != null) && (parent.getElement() == null))
parent = null;
if ((parent != null) && (engine.getElements(StandardAttributesPlugin.getQualifier(engine, parent.getElement()).getId()).size() > 0))
parent = null;
Element element = rs.createRow(parent).getElement();
res = StandardAttributesPlugin.getQualifier(engine, element);
res.setName(sourceQualifier.getName());
engine.updateQualifier(res);
rs.close();
}
return res;
}
use of com.ramussoft.database.common.RowSet in project ramus by Vitaliy-Yakovchuk.
the class NDataPlugin method clear.
@Override
public synchronized void clear() {
for (RowSet rs : rowSets.values()) rs.close();
rowSets.clear();
sectorsRowSet.clear();
loadSectors();
crosspoints.clear();
qualifiers.refresh();
}
use of com.ramussoft.database.common.RowSet in project ramus by Vitaliy-Yakovchuk.
the class NDataPlugin method getRowSet.
public RowSet getRowSet(final long id) {
RowSet res = rowSets.get(id);
if (res == null) {
final Qualifier qualifier = engine.getQualifier(id);
boolean create = true;
if (IDEF0Plugin.isFunction(qualifier)) {
create = false;
List<Attribute> list = new ArrayList<Attribute>(qualifier.getSystemAttributes());
list.addAll(qualifier.getAttributes());
final Qualifier baseFunctions = IDEF0Plugin.getBaseFunctions(engine);
res = new RowSet(engine, qualifier, list.toArray(new Attribute[list.size()]), new RowSet.RowCreater() {
@Override
public com.ramussoft.database.common.Row createRow(Element element, RowSet data, Attribute[] attributes, Object[] objects) {
if (element != null)
return new NFunction(NDataPlugin.this, element, data, attributes, objects) {
@Override
public long getQualifierId() {
if (id == baseFunctions.getId()) {
return IDEF0Plugin.getBaseQualifierId(engine, getElement());
}
return id;
}
};
return new NFunction(NDataPlugin.this, IDEF0Plugin.findElementForBaseFunction(id, engine), data, attributes, objects) {
@Override
public String getName() {
return qualifier.getName();
}
@Override
public boolean isBase() {
return true;
}
@Override
public boolean isElement() {
return false;
}
@Override
public long getQualifierId() {
return id;
}
};
}
}) {
@Override
protected boolean filter(Element element) {
return false;
}
};
}
if (create)
res = new RowSet(engine, qualifier, qualifier.getAttributes().toArray(new Attribute[qualifier.getAttributes().size()]), new RowSet.RowCreater() {
@Override
public com.ramussoft.database.common.Row createRow(Element element, RowSet data, Attribute[] attributes, Object[] objects) {
NRow row = new NRow(NDataPlugin.this, element, data, attributes, objects);
row.setElement(true);
return row;
}
});
rowSets.put(id, res);
}
return res;
}
Aggregations