Package org.apache.cayenne.query

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


    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

                        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

        // 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

                        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

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

        AbstractQuery query = getQuery();

        if (query == null) {
            return;
        }

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

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

        DataMap map = mediator.getCurrentDataMap();
        Query matchingQuery = map.getQuery(newName);

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

        // 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

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

        AbstractQuery query = getQuery();

        if (query == null) {
            return;
        }

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

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

        DataMap map = mediator.getCurrentDataMap();
        Query matchingQuery = map.getQuery(newName);

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

    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

    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

TOP

Related Classes of org.apache.cayenne.query.AbstractQuery

Copyright © 2018 www.massapicom. 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.