Package org.apache.cayenne.access

Examples of org.apache.cayenne.access.DataDomain


        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


                break;
            }
        }

        // check for dupliucates in other DataMaps
        DataDomain domain = path.firstInstanceOf(DataDomain.class);
        if (domain != null) {
            for (DataMap nextMap : domain.getDataMaps()) {
                if (nextMap == map) {
                    continue;
                }

                Embeddable conflictingEmbeddable = nextMap.getEmbeddable(name);
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

                break;
            }
        }

        // check for dupliucates in other DataMaps
        DataDomain domain = path.firstInstanceOf(DataDomain.class);
        if (domain != null) {
            for (DataMap nextMap : domain.getDataMaps()) {
                if (nextMap == map) {
                    continue;
                }

                ObjEntity conflictingEntity = nextMap.getObjEntity(name);
View Full Code Here

    @Override
    public void validateObject(ProjectPath path, Validator validator) {

        // check for empty name
        DataDomain domain = (DataDomain) path.getObject();
        String name = domain.getName();
        if (Util.isEmptyString(name)) {
            validator.registerError("Unnamed DataDomain.", path);

            // no more name assertions
            return;
        }

        Project project = (Project) path.getObjectParent();
        if (project == null) {
            return;
        }

        // check for duplicate names in the parent context
        Iterator it = project.getChildren().iterator();
        while (it.hasNext()) {
            DataDomain dom = (DataDomain) it.next();
            if (dom == domain) {
                continue;
            }

            if (name.equals(dom.getName())) {
                validator.registerError("Duplicate DataDomain name: " + name + ".", path);
                return;
            }
        }
    }
View Full Code Here

    /**
     * Searches for the DataNode described by this DataNodeConfigInfo in the 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 (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

        this.status = status;
    }

    protected DataDomain findDomain(String name) throws FindException {
        DataDomain domain = domains.get(name);
        if (domain == null) {
            throw new FindException("Can't find DataDomain: " + name);
        }

        return domain;
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.