Package org.apache.cayenne.access

Examples of org.apache.cayenne.access.DataDomain


            // top level object of the project
            if (namingContext == null) {
                return false;
            }

            DataDomain domain = (DataDomain) namingContext;
            return domain.getMap(name) != null;
        }
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

            return new DataNode(name);
        }

        @Override
        protected boolean isNameInUse(String name, Object namingContext) {
            DataDomain domain = (DataDomain) namingContext;
            return domain.getNode(name) != 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

        return domain;
    }

    protected DataMap findMap(String domainName, String mapName) throws FindException {
        DataDomain domain = findDomain(domainName);
        DataMap map = domain.getMap(mapName);
        if (map == null) {
            throw new FindException("Can't find DataMap: " + mapName);
        }

        return map;
View Full Code Here

        return map;
    }

    protected DataNode findNode(String domainName, String nodeName) throws FindException {
        DataDomain domain = findDomain(domainName);
        DataNode node = domain.getNode(nodeName);
        if (node == null) {
            throw new FindException("Can't find DataNode: " + nodeName);
        }

        return node;
View Full Code Here

    public void shouldLoadDataDomainProperties(String domainName, Map properties) {
        if (properties == null || properties.isEmpty()) {
            return;
        }

        DataDomain domain = null;
        try {
            domain = findDomain(domainName);
        }
        catch (FindException ex) {
            logger.info("Error: Domain is not loaded: " + domainName);
            throw new ConfigurationException("Domain is not loaded: " + domainName);
        }

        domain.initWithProperties(properties);
    }
View Full Code Here

            logger.info("Error: unnamed <domain>.");
            throw new ConfigurationException("Domain 'name' attribute must be not null.");
        }

        logger.info("loaded domain: " + domainName);
        domains.put(domainName, new DataDomain(domainName));
    }
View Full Code Here

    public void shouldLoadDataMaps(String domainName, Map<String, DataMap> locations) {
        if (locations.size() == 0) {
            return;
        }

        DataDomain domain = null;
        try {
            domain = findDomain(domainName);
        }
        catch (FindException ex) {
            logger.info("Error: Domain is not loaded: " + domainName);
            throw new ConfigurationException("Domain is not loaded: " + domainName);
        }

        // load DataMaps tree
        for (String name : locations.keySet()) {
            DataMap map = domain.getMap(name);
            if (map != null) {
                continue;
            }

            loadDataMap(domain, name, locations);
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.