Package org.apache.cayenne.map

Examples of org.apache.cayenne.map.ObjEntity.addAttribute()


        assertTokensAndExecute(1, 0);

        // need obj attr to be able to query
        ObjAttribute objAttr = new ObjAttribute("newcol2");
        objAttr.setDbAttributePath(column.getName());
        objEntity.addAttribute(objAttr);

        // check that is was merged
        assertTokensAndExecute(0, 0);

        // set not null
View Full Code Here


        ObjEntity objEntity = new ObjEntity("NewTable");
        objEntity.setDbEntity(dbEntity);
        ObjAttribute oatr1 = new ObjAttribute("name");
        oatr1.setDbAttributePath(column2.getName());
        oatr1.setType("java.lang.String");
        objEntity.addAttribute(oatr1);
        map.addObjEntity(objEntity);

        // remove name column
        objEntity.removeAttribute(oatr1.getName());
        dbEntity.removeAttribute(column2.getName());
View Full Code Here

        ObjEntity objEntity = new ObjEntity("NewTable");
        objEntity.setDbEntity(dbEntity);
        ObjAttribute oatr1 = new ObjAttribute("name");
        oatr1.setDbAttributePath(column2.getName());
        oatr1.setType("java.lang.String");
        objEntity.addAttribute(oatr1);
        map.addObjEntity(objEntity);

        // force drop name column in db
        MergerToken token = mergerFactory().createDropColumnToDb(dbEntity, column2);
        execute(token);
View Full Code Here

        ObjEntity objEntity1 = new ObjEntity("NewTable");
        objEntity1.setDbEntity(dbEntity1);
        ObjAttribute oatr1 = new ObjAttribute("name");
        oatr1.setDbAttributePath(e1col2.getName());
        oatr1.setType("java.lang.String");
        objEntity1.addAttribute(oatr1);
        map.addObjEntity(objEntity1);
        ObjEntity objEntity2 = new ObjEntity("NewTable2");
        objEntity2.setDbEntity(dbEntity2);
        ObjAttribute o2a1 = new ObjAttribute("name");
        o2a1.setDbAttributePath(e2col3.getName());
View Full Code Here

        ObjEntity objEntity2 = new ObjEntity("NewTable2");
        objEntity2.setDbEntity(dbEntity2);
        ObjAttribute o2a1 = new ObjAttribute("name");
        o2a1.setDbAttributePath(e2col3.getName());
        o2a1.setType("java.lang.String");
        objEntity2.addAttribute(o2a1);
        map.addObjEntity(objEntity2);

        // create ObjRelationships
        assertEquals(0, objEntity1.getRelationships().size());
        assertEquals(0, objEntity2.getRelationships().size());
View Full Code Here

        ObjEntity objEntity = mediator.getCurrentObjEntity();

        ObjAttribute attr = (ObjAttribute) NamedObjectFactory.createObject(
                ObjAttribute.class,
                objEntity);
        objEntity.addAttribute(attr);

        mediator.fireObjAttributeEvent(new AttributeEvent(
                this,
                attr,
                objEntity,
View Full Code Here

            m1.setClassName(CAY_207Manager1.class.getName());
            ObjAttribute ma1 = new ObjAttribute("clientContactType");
            ma1.setDbAttributePath("CLIENT_CONTACT_TYPE");
            ma1.setType(CAY_207String1.class.getName());
            ma1.setEntity(m1);
            m1.addAttribute(ma1);

            ObjEntity m2 = new ObjEntity("Manager2");
            m2.setSuperEntityName(manager.getName());
            m2.setDeclaredQualifier(Expression.fromString("personType = \"M2\""));
            m2.setClassName(CAY_207Manager2.class.getName());
View Full Code Here

            m2.setClassName(CAY_207Manager2.class.getName());
            ObjAttribute ma2 = new ObjAttribute("clientContactType");
            ma2.setDbAttributePath("CLIENT_CONTACT_TYPE");
            ma2.setType(CAY_207String2.class.getName());
            ma2.setEntity(m2);
            m2.addAttribute(ma2);

            testMap = new DataMap("CAY-207");
            testMap.addObjEntity(m1);
            testMap.addObjEntity(m2);
        }
View Full Code Here

            ObjAttribute artistObjAttr = new ObjAttribute(
                    "smallintUnsigned",
                    "java.lang.Integer",
                    artistObj);
            artistObjAttr.setDbAttributePath("SMALLINT_UNSIGNED");
            artistObj.addAttribute(artistObjAttr);
            getDomain().getEntityResolver().clearCache();
            getDomain().getEntityResolver().getClassDescriptorMap().clearDescriptors();
        }
    }
View Full Code Here

            if (content instanceof ObjAttribute) {
                ObjAttribute attr = (ObjAttribute) content;
                attr.setName(getFreeName(checker, attr.getName()));

                objEntity.addAttribute(attr);
                CreateAttributeAction.fireObjAttributeEvent(this, mediator, mediator
                        .getCurrentDataMap(), objEntity, attr);
            }
            else if (content instanceof ObjRelationship) {
                ObjRelationship rel = (ObjRelationship) content;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.