Package org.apache.cayenne.map

Examples of org.apache.cayenne.map.DataMap


        Iterator nodes = this.getDataNodes().iterator();
        while (nodes.hasNext()) {
            DataNode node = (DataNode) nodes.next();
            Iterator nodeMaps = node.getDataMaps().iterator();
            while (nodeMaps.hasNext()) {
                DataMap map = (DataMap) nodeMaps.next();
                addMap(map);
                nodesByDataMapName.put(map.getName(), node);
            }
        }
    }
View Full Code Here


     * "know" their root.
     *
     * @since 1.2
     */
    public void route(QueryRouter router, EntityResolver resolver, Query substitutedQuery) {
        DataMap map = getMetaData(resolver).getDataMap();

        if (map == null) {
            throw new CayenneRuntimeException("No DataMap found, can't route query "
                    + this);
        }
View Full Code Here

            }

            cayenneQuery.setName(jpaQuery.getName());
            cayenneQuery.setJpaQuery(jpaQuery);

            DataMap parentMap = (DataMap) targetPath.firstInstanceOf(DataMap.class);

            ObjEntity parentEntity = (ObjEntity) targetPath
                    .firstInstanceOf(ObjEntity.class);
            if (parentEntity != null) {
                cayenneQuery.setParentEntity(parentEntity);
            }
            else {
                cayenneQuery.setParentMap(parentMap);
            }

            parentMap.addQuery(cayenneQuery);

            return cayenneQuery;
        }
View Full Code Here

        @Override
        public void onFinishNode(ProjectPath path) {

            JpaEntity entity = path.firstInstanceOf(JpaEntity.class);
            DataMap dataMap = targetPath.firstInstanceOf(DataMap.class);
            ObjEntity cayenneEntity = targetPath.firstInstanceOf(ObjEntity.class);

            // as superentity may not be loaded yet, must lookup DbEntity via JPA
            // mapping...
            DbEntity cayennePrimaryTable = dataMap.getDbEntity(entity
                    .lookupTable()
                    .getName());

            for (JpaSecondaryTable secondaryTable : entity.getSecondaryTables()) {

                // create a relationship between master DbEntity and a secondary
                // DbEntity...

                DbEntity cayenneSecondaryTable = dataMap.getDbEntity(secondaryTable
                        .getName());

                JpaDbRelationship dbRelationship = new JpaDbRelationship(
                        getSecondaryTableDbRelationshipName(secondaryTable.getName()));
                dbRelationship.setTargetEntityName(secondaryTable.getName());
View Full Code Here

        this(context, sqlString, dataMapName, null);
    }
   
    public JpaNativeQuery(ObjectContext context, String sqlString, String dataMapName, String resultSetMappingName) {
        super(context);
        DataMap map = context.getEntityResolver().getDataMap(dataMapName);
        query = new SQLTemplate(map, processSQLString(sqlString));
       
        if(resultSetMappingName != null) {
            query.setResultSetMapping(map.getResultSetMapping(resultSetMappingName));
        }
    }
View Full Code Here

    public synchronized DataMap toDataMap(String name, EntityMapLoaderContext context) {
        this.context = context;

        // 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

        // DbAttribute "no precision" means -1, not 0 like in JPA.
        if (column.getPrecision() > 0) {
            dbAttribute.setAttributePrecision(column.getPrecision());
        }

        DataMap dataMap = targetPath.firstInstanceOf(DataMap.class);
        DbEntity entity = dataMap.getDbEntity(tableName);

        if (entity == null) {
            // table may be defined in a superclass that is not processed yet... so create
            // a barebone version, with all remaining properties to be set later
            entity = new DbEntity(tableName);
            dataMap.addDbEntity(entity);
        }

        entity.addAttribute(dbAttribute);
    }
View Full Code Here

        @Override
        public boolean onStartNode(ProjectPath path) {
            JpaEntityListener jpaListener = (JpaEntityListener) path.getObject();

            DataMap map = (DataMap) targetPath.firstInstanceOf(DataMap.class);
            EntityListener listener = makeEntityListener(jpaListener);
            map.addDefaultEntityListener(listener);

            return false;
        }
View Full Code Here

                public boolean includeTableName(String tableName) {
                    return merger.includeTableName(tableName);
                }
            };
           
            DataMap detectedDataMap = dbLoader.loadDataMapFromDB(
                    null,
                    null,
                    new DataMap());

            Map<String, DbEntity> dbEntityToDropByName = new HashMap<String, DbEntity>(
                    detectedDataMap.getDbEntityMap());

            for (DbEntity dbEntity : dataMap.getDbEntities()) {
                String tableName = dbEntity.getName();
               
                if (!includeTableName(tableName)) {
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

TOP

Related Classes of org.apache.cayenne.map.DataMap

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.