Search in sources :

Example 86 with Qualifier

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

the class RolesView method createComponent.

@Override
public JComponent createComponent() {
    contentPanel = new JPanel(new BorderLayout());
    String property = getProperty(DataPlugin.PROPERTY_OUNERS);
    if (property == null)
        property = "";
    final StringTokenizer st = new StringTokenizer(property, " ");
    List<Qualifier> owners = new ArrayList<Qualifier>();
    while (st.hasMoreElements()) {
        Qualifier owner = getEngine().getQualifier(Long.parseLong(st.nextToken()));
        if (owner != null)
            owners.add(owner);
    }
    if (owners.size() > 0)
        createCenterPanel(owners.get(0));
    return contentPanel;
}
Also used : JPanel(javax.swing.JPanel) StringTokenizer(java.util.StringTokenizer) BorderLayout(java.awt.BorderLayout) ArrayList(java.util.ArrayList) Qualifier(com.ramussoft.common.Qualifier)

Example 87 with Qualifier

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

the class ModelParaleler method getRow.

private Row getRow(long rowId) {
    if (rowId < 0l)
        return null;
    Row res = rowHash.get(rowId);
    if (res == null) {
        Row row = fromDataPlugin.findRowByGlobalId(rowId);
        if (row == null)
            return null;
        Element element = row.getElement();
        if (!((row instanceof Stream) && (element.getName().equals("")))) {
            Qualifier qualifier = null;
            if (row instanceof Stream)
                qualifier = IDEF0Plugin.getBaseStreamQualifier(toEngine);
            else
                qualifier = getQualifier(element.getQualifierId());
            if (qualifier == null)
                return null;
            Element e = toEngine.getElement(element.getName(), qualifier.getId());
            if (e != null) {
                Row row2 = toDataPlugin.findRowByGlobalId(e.getId());
                rowHash.put(e.getId(), row2);
                return row2;
            }
        }
        Row r = fromDataPlugin.findRowByGlobalId(rowId);
        res = toDataPlugin.createRow(getRow(getParentRow(r)), r.isElement());
        rowHash.put(r.getElement().getId(), res);
        copyRow(r, res);
    }
    return res;
}
Also used : Element(com.ramussoft.common.Element) Stream(com.ramussoft.pb.Stream) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.pb.Row)

Example 88 with Qualifier

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

the class ModelParaleler method loadFromParalel.

public void loadFromParalel(boolean importAll, List<Qualifier> selected) {
    List<Attribute> tAttrs = toEngine.getAttributes();
    List<Attribute> fAttrs = fromEngine.getAttributes();
    for (Attribute f : fAttrs) for (Attribute t : tAttrs) if ((f.getName().equals(t.getName())) && (f.getAttributeType().equals(t.getAttributeType())))
        attrHash.put(f.getId(), t);
    List<Qualifier> fList = fromEngine.getQualifiers();
    List<Qualifier> tList = toEngine.getQualifiers();
    for (Qualifier f : fList) if (!IDEF0Plugin.isFunction(f))
        for (Qualifier t : tList) if (!IDEF0Plugin.isFunction(t))
            if (f.getName().equals(t.getName()))
                qHash.put(f.getId(), t);
    Vector<Row> fRows = fromDataPlugin.getRecChilds(null, false);
    Vector<Row> tRows = toDataPlugin.getRecChilds(null, false);
    for (Row f : fRows) for (Row t : tRows) if (f.getName().equals(t.getName())) {
        rowHash.put(f.getElement().getId(), t);
        Vector<Row> fCRows = fromDataPlugin.getRecChilds(f, true);
        Vector<Row> tCRows = toDataPlugin.getRecChilds(t, true);
        for (Row fc : fCRows) for (Row tc : tCRows) if (fc.getName().equals(tc.getName()))
            rowHash.put(fc.getElement().getId(), tc);
    }
    if (importAll) {
        createAllRows();
    }
    for (Qualifier qualifier : selected) {
        fromDataPlugin = NDataPluginFactory.getDataPlugin(qualifier, fromEngine, fromDataPlugin.getAccessRules());
        Qualifier baseFunction = toEngine.createQualifier();
        baseFunction.setName(qualifier.getName());
        IDEF0Plugin.installFunctionAttributes(baseFunction, toEngine);
        toDataPlugin = NDataPluginFactory.getDataPlugin(baseFunction, toEngine, toDataPlugin.getAccessRules());
        base = toDataPlugin.getBaseFunction();
        List<Attribute> list = getAttributes(qualifier.getAttributes());
        for (Attribute a : list) if (baseFunction.getAttributes().indexOf(a) < 0)
            baseFunction.getAttributes().add(a);
        Attribute forName = fromEngine.getAttribute(qualifier.getAttributeForName());
        if (forName != null)
            baseFunction.setAttributeForName(getAttribute(forName).getId());
        toEngine.updateQualifier(baseFunction);
        if (fromDataPlugin.getBaseFunction().getChildCount() > 0) {
            function = (Function) fromDataPlugin.getBaseFunction().getChildAt(0);
            Vector<Row> childs = fromDataPlugin.getRecChilds(function, true);
            childs.add(0, function);
            for (Row row : childs) {
                NFunction dest = (NFunction) getRow(row);
                showMessageAnimation(dest.toString());
            }
            NFunction func = (NFunction) getRow(function);
            createSectorsOnUpperLevel(func);
        }
    }
}
Also used : Attribute(com.ramussoft.common.Attribute) NFunction(com.ramussoft.pb.data.negine.NFunction) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.pb.Row)

Example 89 with Qualifier

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

the class ModelsPanel method openDiagram.

public void openDiagram() {
    RowTreeTable table = tree.getTable();
    final List<OpenDiagram> models = new ArrayList<OpenDiagram>();
    Qualifier modelTree = IDEF0Plugin.getModelTree(engine);
    for (int i : table.getSelectedRows()) {
        if (i >= 0) {
            TreePath path = table.getPathForRow(i);
            if (path != null) {
                TreeTableNode node = (TreeTableNode) path.getLastPathComponent();
                if (node != null) {
                    Row row = node.getRow();
                    if (row != null) {
                        if (row.getElement().getQualifierId() == modelTree.getId()) {
                            Long id = (Long) row.getAttribute(StandardAttributesPlugin.getAttributeQualifierId(engine));
                            if (id != null) {
                                Qualifier model = engine.getQualifier(id);
                                if (model != null) {
                                    OpenDiagram openDiagram = new OpenDiagram(model, -1l);
                                    models.add(openDiagram);
                                }
                            }
                        } else {
                            if (row.getChildCount() <= 0)
                                row = row.getParent();
                            OpenDiagram openDiagram = new OpenDiagram(row.getRowSet().getQualifier(), row.getElementId());
                            models.add(openDiagram);
                        }
                    }
                }
            }
        }
    }
    if (models.size() > 0) {
        if (engine.getPluginProperty("IDEF0", "DataPlugin") == null) {
            framework.showAnimation(GlobalResourcesManager.getString("Wait.DataLoading"));
            Thread thread = new Thread() {

                @Override
                public void run() {
                    NDataPluginFactory.getDataPlugin(null, engine, framework.getAccessRules());
                    SwingUtilities.invokeLater(new Runnable() {

                        @Override
                        public void run() {
                            openDiagrams(models);
                            framework.hideAnimation();
                        }
                    });
                }
            };
            thread.start();
        } else
            openDiagrams(models);
    }
}
Also used : TreeTableNode(com.ramussoft.gui.qualifier.table.TreeTableNode) ArrayList(java.util.ArrayList) TreePath(javax.swing.tree.TreePath) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.database.common.Row) RootRow(com.ramussoft.database.common.RowSet.RootRow) RowTreeTable(com.ramussoft.gui.qualifier.table.RowTreeTable)

Example 90 with Qualifier

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

the class IDEF0TabView method close.

@Override
public void close() {
    super.close();
    framework.removeActionListener(Commands.FULL_REFRESH, fullRefreshAction);
    framework.removeActionListener(CLOSE, closeAction);
    framework.removeActionListener(UPDATE_SIZES, updateSizeAction);
    framework.removeActionListener(DISABLE_SILENT_REFRESH, setSilentRefreshAction);
    Qualifier qualifier = dataPlugin.getBaseFunctionQualifier();
    dataPlugin.getEngine().removeElementAttributeListener(qualifier, reloadMovingArea);
    dataPlugin.getEngine().removeElementAttributeListener(IDEF0Plugin.getBaseFunctions(dataPlugin.getEngine()), reloadMovingArea);
    dataPlugin.getEngine().removeElementListener(qualifier, elementAdapter);
    dataPlugin.getEngine().removeElementListener(IDEF0Plugin.getBaseFunctions(dataPlugin.getEngine()), elementAdapter);
    dataPlugin.getEngine().removeQualifierListener(qualifierListener);
    panel.close();
}
Also used : Qualifier(com.ramussoft.common.Qualifier)

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