Package org.apache.cayenne.map

Examples of org.apache.cayenne.map.Relationship


                joinAppender.appendOuterJoin(
                        joinMarker,
                        new EJBQLTableId(idPath),
                        new EJBQLTableId(fullPath));

                Relationship lastRelationship = currentEntity
                        .getRelationship(lastPathComponent);
                ObjEntity targetEntity = (ObjEntity) lastRelationship.getTargetEntity();

                this.lastAlias = context.getTableAlias(fullPath, targetEntity
                        .getDbEntity().getFullyQualifiedName());
            }
View Full Code Here


                joinAppender.appendOuterJoin(
                        joinMarker,
                        new EJBQLTableId(idPath),
                        new EJBQLTableId(fullPath));

                Relationship lastRelationship = currentEntity
                        .getRelationship(lastPathComponent);
                ObjEntity targetEntity = (ObjEntity) lastRelationship.getTargetEntity();

                this.lastAlias = context.getTableAlias(fullPath, targetEntity
                        .getDbEntity().getFullyQualifiedName());
            }
View Full Code Here

        // at least two elements to constitute a valid ordering path
        if (selectedPath == null || selectedPath.getPathCount() < 2) {
            return;
        }

        Relationship rel = (Relationship) selectedPath.getLastPathComponent();
        DbEntity target = (DbEntity) rel.getTargetEntity();
         /**
         * Initialize root with one of mapped ObjEntities.
         */
        Collection<ObjEntity> objEntities = target.getDataMap().getMappedEntities(target);

View Full Code Here

        }
    }
    // Connects last selected DbRelationship in the path to the
    // last DbEntity, creating a dummy relationship if needed.
    private void connectEnds() {
        Relationship last = null;

        int size = dbRelationships.size();
        if (size > 0) {
            last = dbRelationships.get(size - 1);
        }

        Entity target = getEndEntity();

        if (target != null && (last == null || last.getTargetEntity() != target)) {
            // try to connect automatically, if we can't use dummy connector

            Entity source = (last == null) ? getStartEntity() : last.getTargetEntity();
            if (source != null) {

                Relationship anyConnector = source != null ? source
                        .getAnyRelationship(target) : null;

                if (anyConnector != null) {
                    dbRelationships.add((DbRelationship) anyConnector);
                }
View Full Code Here

        this.fullPath = fullPath + '.' + lastPathComponent;

        if (oldPath != null) {
            this.idPath = oldPath;
            Relationship lastRelationship = currentEntity
                    .getRelationship(lastPathComponent);
            if (lastRelationship != null) {
                ObjEntity targetEntity = (ObjEntity) lastRelationship.getTargetEntity();

                this.lastAlias = context.getTableAlias(fullPath, targetEntity
                        .getDbEntity()
                        .getFullyQualifiedName());
            }
            else {
                this.lastAlias = context.getTableAlias(oldPath, currentEntity
                        .getDbEntity()
                        .getFullyQualifiedName());

            }
        }
        else {
            Relationship lastRelationship = currentEntity
                    .getRelationship(lastPathComponent);

            ObjEntity targetEntity = null;
            if (lastRelationship != null) {
                targetEntity = (ObjEntity) lastRelationship.getTargetEntity();
            }
            else {
                targetEntity = currentEntity;
            }
View Full Code Here

                joinAppender.appendOuterJoin(
                        joinMarker,
                        new EJBQLTableId(idPath),
                        new EJBQLTableId(fullPath));

                Relationship lastRelationship = currentEntity
                        .getRelationship(lastPathComponent);
                DbEntity targetEntity = (DbEntity) lastRelationship.getTargetEntity();

                this.lastAlias = context.getTableAlias(fullPath, targetEntity.getFullyQualifiedName());
            }

            this.idPath = newPath;
View Full Code Here

                joinAppender.appendOuterJoin(
                        joinMarker,
                        new EJBQLTableId(idPath),
                        new EJBQLTableId(fullPath));

                Relationship lastRelationship = currentEntity
                        .getRelationship(lastPathComponent);
                ObjEntity targetEntity = (ObjEntity) lastRelationship.getTargetEntity();

                this.lastAlias = context.getTableAlias(fullPath, targetEntity
                        .getDbEntity().getFullyQualifiedName());
            }
View Full Code Here

                joinAppender.appendOuterJoin(
                        joinMarker,
                        new EJBQLTableId(idPath),
                        new EJBQLTableId(fullPath));

                Relationship lastRelationship = currentEntity
                        .getRelationship(lastPathComponent);
                ObjEntity targetEntity = (ObjEntity) lastRelationship.getTargetEntity();

                this.lastAlias = context.getTableAlias(fullPath, targetEntity
                        .getDbEntityName());
            }
View Full Code Here

                joinAppender.appendOuterJoin(
                        joinMarker,
                        new EJBQLTableId(idPath),
                        new EJBQLTableId(fullPath));

                Relationship lastRelationship = currentEntity
                        .getRelationship(lastPathComponent);
                DbEntity targetEntity = (DbEntity) lastRelationship.getTargetEntity();

                this.lastAlias = context.getTableAlias(fullPath, targetEntity.getName());
            }

            this.idPath = newPath;
View Full Code Here

        DataObject source = findObject(nodeId);

        // find whether this is to-one or to-many
        ObjEntity sourceEntity = context.getEntityResolver().lookupObjEntity(source);
        Relationship relationship = sourceEntity.getRelationship(arcId.toString());

        DataObject target = findObject(targetNodeId);
        if (relationship.isToMany()) {
            source.addToManyTarget(relationship.getName(), target, false);
        }
        else {
            source.setToOneTarget(relationship.getName(), target, false);
        }
    }
View Full Code Here

TOP

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

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.