Package org.apache.cayenne.map

Examples of org.apache.cayenne.map.Relationship


        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,
                        context.getQuotingStrategy().quotedFullyQualifiedName(targetEntity.getDbEntity()));
            } else {
                String tableName = context.getQuotingStrategy().quotedFullyQualifiedName(currentEntity.getDbEntity());
                this.lastAlias = context.getTableAlias(oldPath, tableName);
            }
        } else {
            Relationship lastRelationship = currentEntity.getRelationship(lastPathComponent);

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

            // register join
View Full Code Here


                this.lastAlias = context.getTableAlias(fullPath,
                        context.getQuotingStrategy().quotedFullyQualifiedName(currentEntity));
            } else {
                joinAppender.appendOuterJoin(joinMarker, new EJBQLTableId(idPath), new EJBQLTableId(fullPath));

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

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

                        new RelationshipEvent(this, relationship, relationship
                                .getSourceEntity()));
    }

    private boolean validateName(Entity entity, Relationship aRelationship, String newName) {
        Relationship existing = entity.getRelationship(newName);
        if (existing != null && (aRelationship == null || aRelationship != existing)) {
            JOptionPane.showMessageDialog(
                    this,
                    "There is an existing relationship named \""
                            + newName
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

        relationship.setName(relationshipName);

        Iterator it = dbRelationshipPath.iterator();
        while (it.hasNext()) {
            EntityRelationshipsModel next = (EntityRelationshipsModel) it.next();
            Relationship nextPathComponent = next.getSelectedRelationship();
            if (nextPathComponent == null) {
                break;
            }

            relationship.addDbRelationship((DbRelationship) nextPathComponent);
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 = dbRelationshipPath.size();
        if (size > 0) {
            EntityRelationshipsModel wrapper =
                (EntityRelationshipsModel) dbRelationshipPath.get(size - 1);
            last = wrapper.getSelectedRelationship();

        }

        Entity target = getEndEntity();

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

            Entity source = (last == null) ? getStartEntity() : last.getTargetEntity();
            Relationship anyConnector = source.getAnyRelationship(target);
            EntityRelationshipsModel connector = null;

            connector =
                (anyConnector == null)
                    ? new EntityRelationshipsModel(source, getEndEntity())
View Full Code Here

                                .getSourceEntity()));
        dispose();
    }

    private boolean validateName(Entity entity, Relationship aRelationship, String newName) {
        Relationship existing = entity.getRelationship(newName);
        if (existing != null && (aRelationship == null || aRelationship != existing)) {
            JOptionPane.showMessageDialog(
                    this,
                    "There is an existing relationship named \""
                            + newName
View Full Code Here

    public String getSourceEntityName() {
        return sourceEntity.getName();
    }

    public String getTargetEntityName() {
        Relationship selected = getSelectedRelationship();
        return (selected != null) ? selected.getTargetEntityName() : defaultTargetName;
    }
View Full Code Here

        if (e.getEntity() == null) {
            return;
        }

        // update relationship selection
        Relationship rel = e.getRelationship();
        if (rel instanceof DbRelationship) {
           
            // reset tab to relationship
            if (getSelectedComponent() != relationshipsPanel) {
                setSelectedComponent(relationshipsPanel);
View Full Code Here

            if (target != null) {
                DbEntity srcDB =
                    ((ObjEntity) relationship.getSourceEntity()).getDbEntity();
                DbEntity targetDB = target.getDbEntity();
                if (srcDB != null && targetDB != null) {
                    Relationship anyConnector = srcDB.getAnyRelationship(targetDB);
                    if (anyConnector != null) {
                        relationship.addDbRelationship((DbRelationship) anyConnector);
                    }
                }
            }
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.