Search in sources :

Example 51 with Engine

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);
            }
        }
    }
}
Also used : Qualifier(com.ramussoft.common.Qualifier) Engine(com.ramussoft.common.Engine)

Example 52 with Engine

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;
}
Also used : RowSet(com.ramussoft.report.data.RowSet) List(java.util.List) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.report.data.Row) AnyToAnyPersistent(com.ramussoft.idef0.attribute.AnyToAnyPersistent) Engine(com.ramussoft.common.Engine) Rows(com.ramussoft.report.data.Rows)

Example 53 with Engine

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;
}
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 54 with Engine

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>");
    }
}
Also used : Attribute(com.ramussoft.common.Attribute) ReportQuery(com.ramussoft.report.ReportQuery) Element(com.ramussoft.common.Element) RowSet(com.ramussoft.database.common.RowSet) Qualifier(com.ramussoft.common.Qualifier) IEngine(com.ramussoft.common.IEngine) Engine(com.ramussoft.common.Engine)

Example 55 with Engine

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;
}
Also used : StringTokenizer(java.util.StringTokenizer) ArrayList(java.util.ArrayList) RowSet(com.ramussoft.report.data.RowSet) Qualifier(com.ramussoft.common.Qualifier) Engine(com.ramussoft.common.Engine)

Aggregations

Engine (com.ramussoft.common.Engine)85 Attribute (com.ramussoft.common.Attribute)32 ArrayList (java.util.ArrayList)30 Element (com.ramussoft.common.Element)27 Qualifier (com.ramussoft.common.Qualifier)22 AccessRules (com.ramussoft.common.AccessRules)21 List (java.util.List)19 IEngine (com.ramussoft.common.IEngine)15 Row (com.ramussoft.database.common.Row)13 IOException (java.io.IOException)11 SQLException (java.sql.SQLException)11 PluginFactory (com.ramussoft.common.PluginFactory)8 PluginProvider (com.ramussoft.common.PluginProvider)8 Journaled (com.ramussoft.common.journal.Journaled)8 CachedEngine (com.ramussoft.common.cached.CachedEngine)7 Hashtable (java.util.Hashtable)7 TreeTableNode (com.ramussoft.gui.qualifier.table.TreeTableNode)6 JournaledEngine (com.ramussoft.common.journal.JournaledEngine)5 FileIEngineImpl (com.ramussoft.core.impl.FileIEngineImpl)5 MemoryDatabase (com.ramussoft.database.MemoryDatabase)5