Package org.apache.cayenne.project

Examples of org.apache.cayenne.project.ProjectPath


        DataMap m1 = new DataMap("m1");
        d1.addMap(m1);
        ObjAttribute oa1 = buildValidObjAttribute(m1, "a1");
        validator.reset();
        new ObjAttributeValidator().validateObject(
            new ProjectPath(new Object[] { project, d1, m1, oa1.getEntity(), oa1 }),
            validator);
        assertValidator(ValidationInfo.VALID);

        oa1.setDbAttributePath(null);
        validator.reset();
        new ObjAttributeValidator().validateObject(
            new ProjectPath(new Object[] { project, d1, m1, oa1.getEntity(), oa1 }),
            validator);
        assertValidator(ValidationInfo.WARNING);
    }
View Full Code Here


    public void testValidateDomains() throws Exception {
        // should succeed
        validator.reset();
        DataDomain d1 = new DataDomain("abc");
        new DomainValidator().validateObject(new ProjectPath(new Object[] { project, d1 }), validator);
        assertValidator(ValidationInfo.VALID);

        // should complain about duplicate name
        DataDomain d3 = new DataDomain("xyz");
        project.getConfiguration().addDomain(d3);
        project.getConfiguration().addDomain(d1);
        d3.setName(d1.getName());
        validator.reset();
        new DomainValidator().validateObject(new ProjectPath(new Object[] { project, d3 }), validator);
        assertValidator(ValidationInfo.ERROR);
    }
View Full Code Here

        n1.setDataSourceFactory("123");
        n1.setDataSourceLocation("qqqq");
        d1.addNode(n1);

        validator.reset();
        new DataNodeValidator().validateObject(new ProjectPath(new Object[] { project, d1, n1 }), validator);
        assertValidator(ValidationInfo.VALID);

        // should complain about no location
        DataNode n2 = new DataNode("2");
        n2.setAdapter(new JdbcAdapter());
        n2.setDataSourceFactory("123");
        d1.addNode(n2);

        validator.reset();
        new DataNodeValidator().validateObject(new ProjectPath(new Object[] { project, d1, n2 }), validator);
        assertValidator(ValidationInfo.ERROR);

        // should complain about duplicate name
        DataNode n3 = new DataNode("3");
        n3.setAdapter(new JdbcAdapter());
        n3.setDataSourceFactory("123");
        d1.addNode(n3);
        n3.setName(n1.getName());

        validator.reset();
        new DataNodeValidator().validateObject(new ProjectPath(new Object[] { project, d1, n3 }), validator);
        assertValidator(ValidationInfo.ERROR);
    }
View Full Code Here

                for (int i = 0; i < projectPath.length; i++) {
                    projectPath[i] = ((DefaultMutableTreeNode) path[i]).getUserObject();
                }

                return new ProjectPath(projectPath);
            }
        };

        addTreeSelectionListener(treeSelectionListener);
View Full Code Here

            DefaultMutableTreeNode parentPath) {

        TraversalHelper helper = new TraversalHelper();

        // build a project path from tree node
        ProjectPath path = new ProjectPath();
        if (parentPath != null) {
            path = helper.registerNodes(parentPath.getPath());
        }

        new ProjectTraversal(helper).traverse(node, path);
View Full Code Here

        /**
         * Creates a starting point for tree traversal.
         */
        public ProjectPath registerNodes(TreeNode[] nodes) {
            ProjectPath path = new ProjectPath();

            for (TreeNode node : nodes) {
                DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) node;

                path = path.appendToPath(treeNode.getUserObject());

                // register node with helper
                registerNode(treeNode);
            }

View Full Code Here

        // reset
        DataMap dataMap = new DataMap(name);
        dataMap.setDefaultPackage(context.getEntityMap().getPackageName());
        dataMap.setDefaultSchema(context.getEntityMap().getSchema());

        this.targetPath = new ProjectPath(dataMap);

        if (visitor == null) {
            visitor = createVisitor();
        }
View Full Code Here

        ValidationInfo info = new ValidationInfo(-1, message, null);
        assertEquals(message, info.getMessage());
    }
   
    public void testPath() throws Exception {
        ProjectPath path = new ProjectPath(new Object());
        ValidationInfo info = new ValidationInfo(-1, null, path);
        assertSame(path, info.getPath());
    }
View Full Code Here

        oe1.setClassName("some.javaclass.name");
        map.addObjEntity(oe1);
        map.addDbEntity(de1);

        validator.reset();
        new ObjEntityValidator().validateObject(new ProjectPath(new Object[] {
                project, domain, map, oe1
        }), validator);
        assertValidator(ValidationInfo.VALID);

        // now remove the name
        oe1.setName(null);

        validator.reset();
        new ObjEntityValidator().validateObject(new ProjectPath(new Object[] {
                project, domain, map, oe1
        }), validator);
        assertValidator(ValidationInfo.ERROR);
    }
View Full Code Here

        if (!source.getText().trim().equals("")) {
            Pattern pattern = Pattern.compile(source.getText().trim(), Pattern.CASE_INSENSITIVE);

            Iterator it = getProjectController().getProject().treeNodes();
            while(it.hasNext()) {
                ProjectPath path = (ProjectPath) it.next();
               
                Object o = path.getObject();
                if ((o instanceof ObjEntity || o instanceof DbEntity) && matchFound(((Entity) o).getName(), pattern))
                    paths.add(path.getPath());
                else if (o instanceof Attribute && matchFound(((Attribute) o).getName(), pattern))
                    paths.add(path.getPath());
                else if (o instanceof Relationship && matchFound(((Relationship) o).getName(), pattern))
                    paths.add(path.getPath());
                else if (o instanceof Query && matchFound(((Query) o).getName(), pattern))
                    paths.add(path.getPath());
                else if (o instanceof Embeddable && matchFound(((Embeddable) o).getClassName(), pattern))
                    paths.add(path.getPath());
                else if (o instanceof EmbeddableAttribute && matchFound(((EmbeddableAttribute) o).getName(), pattern))
                    paths.add(path.getPath());
            }
        }
    
        if(paths.size()==0){
            source.setBackground(Color.pink);
View Full Code Here

TOP

Related Classes of org.apache.cayenne.project.ProjectPath

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.