Search in sources :

Example 36 with Qualifier

use of com.ramussoft.common.Qualifier 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;
}
Also used : Attribute(com.ramussoft.common.Attribute) Element(com.ramussoft.common.Element) RowSet(com.ramussoft.database.common.RowSet) ArrayList(java.util.ArrayList) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.pb.Row)

Example 37 with Qualifier

use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.

the class ModelsPanel method openDiagram.

private void openDiagram(TreePath path) {
    Object object = path.getLastPathComponent();
    if (object instanceof ModelsNode) {
        Qualifier qualifier = ((ModelsNode) object).getQualifier();
        OpenDiagram open = new OpenDiagram(qualifier, -1l);
        framework.propertyChanged(IDEF0ViewPlugin.OPEN_DIAGRAM, open);
    } else {
        Row row = (Row) object;
        if (row.getChildCount() == 0)
            row = row.getParent();
        if (row instanceof ModelsNode) {
            Qualifier qualifier = ((ModelsNode) row).getQualifier();
            OpenDiagram open = new OpenDiagram(qualifier, -1l);
            framework.propertyChanged(IDEF0ViewPlugin.OPEN_DIAGRAM, open);
        } else {
            if ((row != null) && (row.getElement() != null)) {
                Qualifier qualifier = engine.getQualifier(row.getElement().getQualifierId());
                OpenDiagram open = new OpenDiagram(qualifier, row.getElementId());
                framework.propertyChanged(IDEF0ViewPlugin.OPEN_DIAGRAM, open);
            }
        }
    }
}
Also used : OpenDiagram(com.ramussoft.idef0.OpenDiagram) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.database.common.Row)

Example 38 with Qualifier

use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method replaceIDEF0Row.

private Row replaceIDEF0Row(Row row) {
    if (IDEF0Plugin.getBaseFunctions(dataPlugin.getEngine()).getId() == row.getElement().getQualifierId()) {
        Qualifier base = IDEF0Plugin.getBaseQualifier(dataPlugin.getEngine(), row.getElement());
        row = NDataPluginFactory.getDataPlugin(base, dataPlugin.getEngine(), dataPlugin.getAccessRules()).getBaseFunction();
    }
    return row;
}
Also used : Qualifier(com.ramussoft.common.Qualifier)

Example 39 with Qualifier

use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method printModelsList.

protected void printModelsList() throws IOException {
    printMainTableTitle(GlobalResourcesManager.getString("ModelsView"));
    for (Qualifier q : IDEF0Plugin.getBaseQualifiers(dataPlugin.getEngine())) {
        com.ramussoft.database.common.Row row = dataPlugin.getRowSet(q.getId()).getRoot();
        final String href = "idef0/index.html?id=" + row.getElement().getId();
        htmlStream.print("<tr><td valign=\"top\" colspan=\"2\">");
        printStartATeg(href);
        htmlStream.print(q.getName());
        printEndATeg();
        htmlStream.println("</td></tr>");
    }
}
Also used : Qualifier(com.ramussoft.common.Qualifier)

Example 40 with Qualifier

use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method printArrowFunctionss.

private void printArrowFunctionss(final Row row) throws IOException {
    final Vector funcs = new Vector<Row>();
    List<Qualifier> list = dataPlugin.getEngine().getQualifiers();
    for (Qualifier q : list) {
        if (IDEF0Plugin.isFunction(q)) {
            DataPlugin dp = NDataPluginFactory.getDataPlugin(q, dataPlugin.getEngine(), dataPlugin.getAccessRules());
            funcs.addAll(dp.getRecChilds(dp.getBaseFunction(), true));
        }
    }
    final Vector<UF> res = new Vector<UF>();
    for (int i = 0; i < funcs.size(); i++) {
        addFunction(row, (Function) funcs.get(i), res);
    }
    if (res.size() > 0) {
        htmlStream.println("<p><table width=100% border=1>");
        printMainTableTitle(RES.getString("UseInFunctions"), 3);
        htmlStream.print("<tr>");
        htmlStream.print("<td><b>");
        htmlStream.print(RES.getString("kod"));
        htmlStream.print("</b></td>");
        htmlStream.print("<td width=100%><b>");
        htmlStream.print(RES.getString("FunctionName"));
        htmlStream.print("</b></td>");
        htmlStream.print("<td><b>");
        htmlStream.print(RES.getString("Type"));
        htmlStream.print("</b></td>");
        htmlStream.println("</tr>");
        for (int i = 0; i < res.size(); i++) {
            final UF uf = res.get(i);
            htmlStream.println("<tr>");
            htmlStream.print("<td>");
            printStartATeg("rows/index.html?id=" + uf.function.getGlobalId().toString());
            htmlStream.print(MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) uf.function));
            htmlStream.print("</td>");
            htmlStream.print("<td width=100%>");
            printStartATeg("rows/index.html?id=" + uf.function.getGlobalId().toString());
            htmlStream.print(uf.function.getName());
            htmlStream.print("</td>");
            htmlStream.print("<td>");
            switch(uf.type) {
                case MovingPanel.RIGHT:
                    htmlStream.print(RES.getString("RightElements"));
                    break;
                case MovingPanel.LEFT:
                    htmlStream.print(RES.getString("LeftElements"));
                    break;
                case MovingPanel.TOP:
                    htmlStream.print(RES.getString("TopElements"));
                    break;
                case MovingPanel.BOTTOM:
                    htmlStream.print(RES.getString("BottomElements"));
                    break;
            }
            htmlStream.print("</td>");
            htmlStream.println("</tr>");
        }
        htmlStream.println("</table></p>");
    }
}
Also used : Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.pb.Row) NRow(com.ramussoft.pb.data.negine.NRow) DataPlugin(com.ramussoft.pb.DataPlugin) AbstractDataPlugin(com.ramussoft.pb.data.AbstractDataPlugin) Vector(java.util.Vector)

Aggregations

Qualifier (com.ramussoft.common.Qualifier)157 Attribute (com.ramussoft.common.Attribute)72 Element (com.ramussoft.common.Element)59 ArrayList (java.util.ArrayList)45 Engine (com.ramussoft.common.Engine)22 Row (com.ramussoft.database.common.Row)17 Row (com.ramussoft.pb.Row)14 List (java.util.List)12 Hashtable (java.util.Hashtable)11 QualifierEvent (com.ramussoft.common.event.QualifierEvent)10 ResultSet (java.sql.ResultSet)9 SQLException (java.sql.SQLException)9 AttributeType (com.ramussoft.common.AttributeType)8 RowSet (com.ramussoft.database.common.RowSet)8 DataPlugin (com.ramussoft.pb.DataPlugin)8 NFunction (com.ramussoft.pb.data.negine.NFunction)8 AttributeEvent (com.ramussoft.common.event.AttributeEvent)7 Journaled (com.ramussoft.common.journal.Journaled)7 RowMapper (com.ramussoft.jdbc.RowMapper)7 IEngine (com.ramussoft.common.IEngine)6