Examples of AbstractQuery


Examples of org.apache.cayenne.query.AbstractQuery

        // TODO: (Andrus, 09/09/2005) show warning dialog?

        // clone to be able to remove within iterator...
        for (Query query : new ArrayList<Query>(map.getQueries())) {
            if (query instanceof AbstractQuery) {
                AbstractQuery next = (AbstractQuery) query;
                Object root = next.getRoot();

                if (root == entity
                        || (root instanceof String && root.toString().equals(
                                entity.getName()))) {
                    removeQuery(map, next);
View Full Code Here

Examples of org.apache.cayenne.query.AbstractQuery

                        dataMap,
                        embeddable);
            }
            else if (content instanceof Query) {
                // paste Query to DataMap
                AbstractQuery query = (AbstractQuery) content;

                /**
                 * Change Query root do current datamap's
                 */
                Object root = query.getRoot();
                Object newRoot = root;

                if (root instanceof ObjEntity) {
                    newRoot = dataMap.getObjEntity(((ObjEntity) root).getName());
                }
                else if (root instanceof DbEntity) {
                    newRoot = dataMap.getDbEntity(((DbEntity) root).getName());
                }
                else if (root instanceof Procedure) {
                    newRoot = dataMap.getProcedure(((Procedure) root).getName());
                }

                if (newRoot == null) {
                    JOptionPane
                            .showMessageDialog(
                                    Application.getFrame(),
                                    "Query root cannot be resolved. Pasting has not been performed.",
                                    "Warning",
                                    JOptionPane.WARNING_MESSAGE);
                    return;
                }

                query.setName(getFreeName(new QueryNameChecker(domain), query.getName()));
                query.setDataMap(dataMap);

                dataMap.addQuery(query);
                QueryTypeController.fireQueryEvent(this, mediator, dataMap, query);
            }
            else if (content instanceof Procedure) {
View Full Code Here

Examples of org.apache.cayenne.query.AbstractQuery

        assertSame(e, map.getDbEntity(e.getName()));
        assertSame(map, e.getDataMap());
    }

    public void testAddQuery() {
        AbstractQuery q = new MockAbstractQuery("a");
        DataMap map = new DataMap();
        map.addQuery(q);
        assertSame(q, map.getQuery("a"));
    }
View Full Code Here

Examples of org.apache.cayenne.query.AbstractQuery

        map.addQuery(q);
        assertSame(q, map.getQuery("a"));
    }

    public void testRemoveQuery() {
        AbstractQuery q = new MockAbstractQuery("a");

        DataMap map = new DataMap();
        map.addQuery(q);
        assertSame(q, map.getQuery("a"));
        map.removeQuery("a");
View Full Code Here

Examples of org.apache.cayenne.query.AbstractQuery

        map.removeQuery("a");
        assertNull(map.getQuery("a"));
    }

    public void testGetQueryMap() {
        AbstractQuery q = new MockAbstractQuery("a");
        DataMap map = new DataMap();
        map.addQuery(q);
        Map<String, Query> queries = map.getQueryMap();
        assertEquals(1, queries.size());
        assertSame(q, queries.get("a"));
View Full Code Here

Examples of org.apache.cayenne.query.AbstractQuery

    private void initController() {

        queryRoot.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent event) {
                AbstractQuery query = (AbstractQuery) mediator.getCurrentQuery();
                if (query != null) {
                    query.setRoot(queryRoot.getModel().getSelectedItem());
                    mediator.fireQueryEvent(new QueryEvent(this, query));
                }
            }
        });
View Full Code Here

Examples of org.apache.cayenne.query.AbstractQuery

    void setQueryName(String newName) {
        if (newName != null && newName.trim().length() == 0) {
            newName = null;
        }

        AbstractQuery query = (AbstractQuery) mediator.getCurrentQuery();
        if (query == null) {
            return;
        }

        if (Util.nullSafeEquals(newName, query.getName())) {
            return;
        }

        if (newName == null) {
            throw new ValidationException("Query name is required.");
        }

        DataMap map = mediator.getCurrentDataMap();

        if (map.getQuery(newName) == null) {
            // completely new name, set new name for entity
            QueryEvent e = new QueryEvent(this, query, query.getName(), map);
            ProjectUtil.setQueryName(map, query, newName);
            mediator.fireQueryEvent(e);
        }
        else {
            // there is a query with the same name
View Full Code Here

Examples of org.apache.cayenne.query.AbstractQuery

                        dataMap,
                        embeddable);
            }
            else if (content instanceof Query) {
                // paste Query to DataMap
                AbstractQuery query = (AbstractQuery) content;

                /**
                 * Change Query root do current datamap's
                 */
                Object root = query.getRoot();
                Object newRoot = root;

                if (root instanceof ObjEntity) {
                    newRoot = dataMap.getObjEntity(((ObjEntity) root).getName());
                }
                else if (root instanceof DbEntity) {
                    newRoot = dataMap.getDbEntity(((DbEntity) root).getName());
                }
                else if (root instanceof Procedure) {
                    newRoot = dataMap.getProcedure(((Procedure) root).getName());
                }

                if (newRoot == null) {
                    JOptionPane
                            .showMessageDialog(
                                    Application.getFrame(),
                                    "Query root cannot be resolved. Pasting has not been performed.",
                                    "Warning",
                                    JOptionPane.WARNING_MESSAGE);
                    return;
                }

                query.setName(getFreeName(new QueryNameChecker(domain), query.getName()));
                query.setDataMap(dataMap);

                dataMap.addQuery(query);
                QueryType.fireQueryEvent(this, mediator, dataMap, query);
            }
            else if (content instanceof Procedure) {
View Full Code Here

Examples of org.apache.cayenne.query.AbstractQuery

        // TODO: (Andrus, 09/09/2005) show warning dialog?

        // clone to be able to remove within iterator...
        for (Query query : new ArrayList<Query>(map.getQueries())) {
            if (query instanceof AbstractQuery) {
                AbstractQuery next = (AbstractQuery) query;
                Object root = next.getRoot();
   
                if (root == entity
                        || (root instanceof String && root
                                .toString()
                                .equals(entity.getName()))) {
View Full Code Here

Examples of org.apache.cayenne.query.AbstractQuery

                        dataMap,
                        embeddable);
            }
            else if (content instanceof Query) {
                // paste Query to DataMap
                AbstractQuery query = (AbstractQuery) content;

                /**
                 * Change Query root do current datamap's
                 */
                Object root = query.getRoot();
                Object newRoot = root;

                if (root instanceof ObjEntity) {
                    newRoot = dataMap.getObjEntity(((ObjEntity) root).getName());
                }
                else if (root instanceof DbEntity) {
                    newRoot = dataMap.getDbEntity(((DbEntity) root).getName());
                }
                else if (root instanceof Procedure) {
                    newRoot = dataMap.getProcedure(((Procedure) root).getName());
                }

                if (newRoot == null) {
                    JOptionPane
                            .showMessageDialog(
                                    Application.getFrame(),
                                    "Query root cannot be resolved. Pasting has not been performed.",
                                    "Warning",
                                    JOptionPane.WARNING_MESSAGE);
                    return;
                }

                query.setName(getFreeName(new QueryNameChecker(domain), query.getName()));

                dataMap.addQuery(query);
                QueryTypeController.fireQueryEvent(this, mediator, mediator
                        .getCurrentDataDomain(), dataMap, query);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.