Search in sources :

Example 26 with Qualifier

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

the class OtherElementPlugin method replaceElements.

@Override
public void replaceElements(Engine engine, Element[] oldElements, Element newElement) {
    for (Qualifier qualifier : getAllNotSystemQualifiers(engine)) {
        List<Attribute> attributes = new ArrayList<Attribute>();
        for (Attribute attribute : qualifier.getAttributes()) {
            if ((attribute.getAttributeType().getPluginName().equals(getName())) && (attribute.getAttributeType().getTypeName().equals(getTypeName()))) {
                OtherElementPropertyPersistent p = (OtherElementPropertyPersistent) engine.getAttribute(null, attribute);
                if (p.getQualifier() == newElement.getQualifierId())
                    attributes.add(attribute);
            }
        }
        Hashtable<Element, Object[]> hash = engine.getElements(qualifier, attributes);
        Enumeration<Element> keys = hash.keys();
        while (keys.hasMoreElements()) {
            Element key = keys.nextElement();
            Object[] objects = hash.get(key);
            int aIndex = 0;
            for (Object object : objects) if (object != null) {
                Long l = (Long) object;
                for (Element element : oldElements) {
                    if (element.getId() == l.longValue()) {
                        engine.setAttribute(key, attributes.get(aIndex), newElement.getId());
                        break;
                    }
                }
                aIndex++;
            }
        }
    }
}
Also used : Attribute(com.ramussoft.common.Attribute) Element(com.ramussoft.common.Element) ArrayList(java.util.ArrayList) Qualifier(com.ramussoft.common.Qualifier) FindObject(com.ramussoft.common.attribute.FindObject)

Example 27 with Qualifier

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

the class EvalPlugin method getQualifier.

private Qualifier getQualifier(long qualifierId, Hashtable<Long, Qualifier> qualifiers, Engine engine) {
    Qualifier qualifier = qualifiers.get(qualifierId);
    if (qualifier == null) {
        qualifier = engine.getQualifier(qualifierId);
        qualifiers.put(qualifierId, qualifier);
    }
    return qualifier;
}
Also used : Qualifier(com.ramussoft.common.Qualifier)

Example 28 with Qualifier

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

the class SelectRowDialog method showModal.

public List<com.ramussoft.pb.Row> showModal() {
    final Qualifier q1 = qualifier;
    selectedRows.clear();
    createComponents();
    if (q1 != null) {
        Options.saveOptions(this);
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                qualifierView.setSelectedQualifier(q1);
                Options.loadOptions(SelectRowDialog.this);
                addQualifier = false;
            }
        });
    }
    ok = false;
    setVisible(true);
    deleteComponents();
    List<com.ramussoft.pb.Row> result = new ArrayList<com.ramussoft.pb.Row>();
    if (ok) {
        for (List<Row> list : selectedRows.values()) {
            for (Row row : list) {
                com.ramussoft.pb.Row r = dataPlugin.findRowByGlobalId(row.getElementId());
                if (r != null)
                    result.add(r);
            }
        }
        if ((addQualifier) && (qualifier != null)) {
            Engine engine = dataPlugin.getEngine();
            Qualifier q = StandardAttributesPlugin.getQualifiersQualifier(engine);
            List<Element> list = engine.getElements(q.getId());
            for (Element element : list) {
                if (qualifier.equals(StandardAttributesPlugin.getQualifier(engine, element))) {
                    com.ramussoft.pb.Row r = dataPlugin.findRowByGlobalId(element.getId());
                    if (r != null) {
                        result.add(r);
                    } else {
                        System.err.println("WARNING: Can not find element for qualifier (" + qualifier.getName() + ")");
                    }
                }
            }
        }
    }
    Options.saveOptions(this);
    return result;
}
Also used : Element(com.ramussoft.common.Element) ArrayList(java.util.ArrayList) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.database.common.Row) Engine(com.ramussoft.common.Engine)

Example 29 with Qualifier

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

the class IDEF0ConnectionPlugin method getOuners.

private Rows getOuners(Data data, String name) {
    List<Long> ids = OwnersConnection.loadOunerIDs(data.getEngine());
    Rows rows = new Rows(null, data, false);
    rows.setQualifierName(name);
    for (Long long1 : ids) {
        Qualifier qualifier = data.getQualifier(long1.longValue());
        if (qualifier != null)
            rows.addAll(data.getRows(qualifier));
    }
    return rows;
}
Also used : Qualifier(com.ramussoft.common.Qualifier) Rows(com.ramussoft.report.data.Rows)

Example 30 with Qualifier

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

the class ChartSourceSelectPanel method createRightPanel.

private void createRightPanel() {
    if (qualifierView == null)
        return;
    Qualifier qualifier = qualifierView.getSelectedQualifier();
    boolean b = qualifier != null;
    if (b) {
        framework.setOpenDynamikViewEvent(new ActionEvent(QualifierPlugin.OPEN_QUALIFIER, qualifier));
        QualifierSource qualifierSource = null;
        for (QualifierSource s : chartSource.getQualifierSources()) {
            if (s.getQualifier().equals(qualifier)) {
                qualifierSource = s;
                break;
            }
        }
        if (qualifierSource == null) {
            qualifierSource = chartSource.createQualifierSource();
            qualifierSource.setQualifier(qualifier);
            chartSource.getQualifierSources().add(qualifierSource);
        }
        qualifierSelectPanel = new QualifierSourceSelectPanel(framework, qualifier, qualifierSource, (sourceType.getSelectedItem().equals(sourceTypeElements)) ? SelectType.CHECK : SelectType.RADIO);
        int dl = pane.getDividerLocation();
        pane.setRightComponent(qualifierSelectPanel);
        pane.revalidate();
        pane.repaint();
        pane.setDividerLocation(dl);
    }
}
Also used : QualifierSource(com.ramussoft.chart.QualifierSource) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) 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