use of com.ramussoft.common.Engine in project ramus by Vitaliy-Yakovchuk.
the class AttributePreferenciesDialogWithQualifierSet method postApply.
@Override
protected void postApply() {
super.postApply();
Engine engine = framework.getEngine();
List<Qualifier> all = component.getAll();
List<Qualifier> selected = component.getSelected();
for (Qualifier qualifier : all) {
if (selected.indexOf(qualifier) >= 0) {
if (qualifier.getAttributes().indexOf(attribute) < 0) {
qualifier.getAttributes().add(attribute);
engine.updateQualifier(qualifier);
}
} else {
if (qualifier.getAttributes().indexOf(attribute) >= 0) {
qualifier.getAttributes().remove(attribute);
engine.updateQualifier(qualifier);
}
}
}
}
use of com.ramussoft.common.Engine 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;
}
use of com.ramussoft.common.Engine 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.common.Engine in project ramus by Vitaliy-Yakovchuk.
the class HTTPParser method printReportsList.
/**
* Друкує список звітів з посиланнями на них.
*
* @throws IOException
*/
protected void printReportsList() throws IOException {
Engine engine = dataPlugin.getEngine();
Qualifier qualifier = ReportPlugin.getReportsQualifier(engine);
Attribute name = ReportPlugin.getReportNameAttribute(engine);
RowSet rowSet = new RowSet(engine, qualifier, new Attribute[] { name }, null, true);
List<Element> reports = ((ReportQuery) engine).getHTMLReports();
if (reports.size() == 0)
return;
printMainTableTitle(RES.getString("reportsTitle"));
for (com.ramussoft.database.common.Row element : rowSet.getAllRows()) {
htmlStream.println("<tr>");
htmlStream.println("<td colspan=2>");
printStartATeg("reportsq/index.html?num=" + element.getElementId());
htmlStream.println(element.getCode());
printEndATeg();
printStartATeg("reportsq/index.html?num=" + element.getElementId());
htmlStream.print(element.getName());
printEndATeg();
htmlStream.println("</td>");
htmlStream.println("</tr>");
}
}
use of com.ramussoft.common.Engine in project ramus by Vitaliy-Yakovchuk.
the class FastIdef0Connection method getQualifiers.
public List<Qualifier> getQualifiers(Data data, String modelName) {
Engine engine = data.getEngine();
List<Qualifier> qualifiers = new ArrayList<Qualifier>();
if ("[ALL MODELS]".equals(modelName)) {
for (Qualifier qualifier : engine.getQualifiers()) if (IDEF0Plugin.isFunction(qualifier))
qualifiers.add(qualifier);
} else {
com.ramussoft.database.common.RowSet rowSet = new com.ramussoft.database.common.RowSet(engine, IDEF0Plugin.getModelTree(engine), new Attribute[] { StandardAttributesPlugin.getAttributeNameAttribute(engine) }, null, true);
StringTokenizer st = new StringTokenizer(modelName, Data.QUALIFIER_DELIMETER);
while (st.hasMoreElements()) {
com.ramussoft.database.common.Row row = rowSet.findRow(st.nextToken());
if (row != null)
addQualifiers(data.getEngine(), qualifiers, row);
}
Qualifier qualifier = engine.getQualifierByName(modelName);
if (qualifier != null && !qualifiers.contains(qualifier))
qualifiers.add(qualifier);
}
return qualifiers;
}
Aggregations