Package org.apache.cayenne.access

Examples of org.apache.cayenne.access.DataDomain


        if (sort) {
            domains = Util.sortedIterator(domains, ProjectTraversal.dataDomainComparator);
        }

        while (domains.hasNext()) {
            DataDomain domain = (DataDomain) domains.next();
            ProjectPath domainPath = path.appendToPath(domain);
            handler.projectNode(domainPath);

            if (handler.shouldReadChildren(domain, path)) {
                this.traverseMaps(domain.getDataMaps().iterator(), domainPath);
                this.traverseNodes(domain.getDataNodes().iterator(), domainPath);
            }
        }
    }
View Full Code Here


        if (domain.getName() == null) {
            throw new NullPointerException("Attempt to add DataDomain with no name.");
        }
       
        DataDomain old = dataDomains.put(domain.getName(), domain);
        if (old != null && old != domain) {
            dataDomains.put(domain.getName(), old);
            throw new IllegalArgumentException("Attempt to overwrite domain with name "
                    + domain.getName());
        }
View Full Code Here

     * this Configuration object. Note that any domain database
     * connections remain open, and it is a responsibility of a
     * caller to clean it up.
     */
    public void removeDomain(String name) {
        DataDomain domain = dataDomains.remove(name);

        if (domain != null) {
            domain.setEventManager(null);
        }
    }
View Full Code Here

     * provided configuration object. Throws ProjectException if there is no
     * matching DataNode.
     */
    public DataNode findDataNode(Configuration config)
        throws ProjectException {
        DataDomain domainObj = null;

        // domain name is either explicit, or use default domain
        if (domain != null) {
            domainObj = config.getDomain(domain);

            if (domainObj == null) {
                throw new ProjectException("Can't find domain named " + domain);
            }
        } else {
            try {
                domainObj = config.getDomain();
            } catch (Exception ex) {
                throw new ProjectException("Project has no default domain.", ex);
            }

            if (domainObj == null) {
                throw new ProjectException("Project has no domains configured.");
            }
        }

        DataNode node = domainObj.getNode(name);
        if (node == null) {
            throw new ProjectException(
                "Domain "
                    + domainObj.getName()
                    + " has no node named '"
                    + name
                    + "'.");
        }
        return node;
View Full Code Here

        if (Util.isEmptyString(name)) {
            validator.registerError("Unnamed DataNode.", path);
            return;
        }

        DataDomain domain = (DataDomain) path.getObjectParent();
        if (domain == null) {
            return;
        }

        // check for duplicate names in the parent context
        for (final DataNode otherNode : domain.getDataNodes()) {
            if (otherNode == node) {
                continue;
            }

            if (name.equals(otherNode.getName())) {
View Full Code Here

    public RuntimeSaveDelegate() {
        super();
    }

    protected DataDomain findDomain(String domainName) {
        DataDomain domain = config.getDomain(domainName);
        if (domain == null) {
            throw new IllegalArgumentException("Can't find DataDomain: " + domainName);
        }

        return domain;
View Full Code Here

        return domain;
    }

    protected DataNode findNode(String domainName, String nodeName) {
        DataDomain domain = findDomain(domainName);
        DataNode node = domain.getNode(nodeName);
        if (node == null) {
            throw new IllegalArgumentException("Can't find DataNode: "
                    + domainName
                    + "."
                    + nodeName);
View Full Code Here

        // check if data map is not attached to any nodes
        validateNodeLinks(map, path, validator);
    }

    protected void validateNodeLinks(DataMap map, ProjectPath path, Validator validator) {
        DataDomain domain = (DataDomain) path.getObjectParent();
        if (domain == null) {
            return;
        }
       
        boolean unlinked = true;
        int nodeCount = 0;
        for (final DataNode node : domain.getDataNodes()) {
            nodeCount++;
            if (node.getDataMaps().contains(map)) {
                unlinked = false;
                break;
            }
View Full Code Here

        if (Util.isEmptyString(name)) {
            validator.registerError("Unnamed DataMap.", path);
            return;
        }

        DataDomain domain = (DataDomain) path.getObjectParent();
        if (domain == null) {
            return;
        }

        // check for duplicate names in the parent context
        for (final DataMap otherMap : domain.getDataMaps()) {
            if (otherMap == map) {
                continue;
            }

            if (name.equals(otherMap.getName())) {
View Full Code Here

            return "UntitledDomain";
        }

        @Override
        protected Object create(String name, Object namingContext) {
            return new DataDomain(name);
        }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.access.DataDomain

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.