Package org.apache.cayenne.reflect

Examples of org.apache.cayenne.reflect.Property


        String reverseName = relationship.getReverseRelationshipName();
        Accessor accessor = new JpaCollectionFieldAccessor(
                descriptor.getObjectClass(),
                relationship.getName(),
                Set.class);
        Property property = new JpaSetProperty(
                descriptor,
                targetDescriptor,
                accessor,
                reverseName);
View Full Code Here


        Accessor accessor = new JpaCollectionFieldAccessor(
                descriptor.getObjectClass(),
                relationship.getName(),
                Collection.class);
        Property property = new JpaListProperty(
                descriptor,
                targetDescriptor,
                accessor,
                reverseName);
View Full Code Here

            ArcOperation arcDiff = (ArcOperation) diff;
            Object targetId = arcDiff.getTargetNodeId();
            String arcId = arcDiff.getArcId().toString();

            Property property = getClassDescriptor().getProperty(arcId);

            // note that some collection properties implement 'SingleObjectArcProperty',
            // so we cant't do 'instanceof SingleObjectArcProperty'
            // TODO: andrus, 3.22.2006 - should we consider this a bug?

            if (property instanceof ToManyProperty) {

                // record flattened op changes
                ObjEntity entity = object
                        .getObjectContext()
                        .getEntityResolver()
                        .getObjEntity(entityName);

                ObjRelationship relationship = (ObjRelationship) entity
                        .getRelationship(property.getName());
                if (relationship.isFlattened()) {

                    if (flatIds == null) {
                        flatIds = new HashMap();
                    }
View Full Code Here

                for (int i = 1; i < path.getChildrenCount(); i++) {

                    String pathChunk = path.getChild(i).getText();
                    buffer.append('.').append(pathChunk);

                    Property property = descriptor.getProperty(pathChunk);
                    if (property instanceof ArcProperty) {
                        ObjRelationship incoming = ((ArcProperty) property)
                                .getRelationship();
                        descriptor = ((ArcProperty) property).getTargetDescriptor();
                        String pathString = buffer.substring(0, buffer.length());
View Full Code Here

            return true;
        }

        @Override
        public boolean visitIdentificationVariable(EJBQLExpression expression) {
            Property property = descriptor.getProperty(expression.getText());
            if (property instanceof ArcProperty) {
                incoming = ((ArcProperty) property).getRelationship();
                descriptor = ((ArcProperty) property).getTargetDescriptor();
            }
            else {
View Full Code Here

        Persistent object = (Persistent) context.getGraphManager().getNode(nodeId);
        if (object != null && object.getPersistenceState() != PersistenceState.HOLLOW) {

            // do not override local changes....
            Property p = propertyForId(nodeId, property);
            if (Util.nullSafeEquals(p.readPropertyDirectly(object), oldValue)) {
                p.writePropertyDirectly(object, oldValue, newValue);
            }
        }
    }
View Full Code Here

        final Persistent source = (Persistent) context.getGraphManager().getNode(nodeId);
        if (source != null && source.getPersistenceState() != PersistenceState.HOLLOW) {

            final int state = source.getPersistenceState();

            Property p = propertyForId(nodeId, arcId.toString());
            p.visit(new PropertyVisitor() {

                public boolean visitAttribute(AttributeProperty property) {
                    return false;
                }
View Full Code Here

            return;
        }

        ClassDescriptor descriptor = context.getEntityResolver().getClassDescriptor(
                ((ObjectId) nodeId).getEntityName());
        Property property = descriptor.getProperty(arcId.toString());
        property.visit(new PropertyVisitor() {

            public boolean visitAttribute(AttributeProperty property) {
                return false;
            }

            public boolean visitToMany(ToManyProperty property) {
                // connect reverse arc if the relationship is marked as "runtime"
                ArcProperty reverseArc = property.getComplimentaryReverseArc();
                boolean autoConnectReverse = reverseArc != null
                        && reverseArc.getRelationship().isRuntime();

                Persistent target = findObject(targetNodeId);

                if (target == null) {

                    // this is usually the case when a NEW object was deleted and then its
                    // relationships were manipulated; so try to locate the object in the
                    // collection ...
                    // the performance of this is rather dubious of course...
                    target = findObjectInCollection(targetNodeId, property
                            .readProperty(source));
                }

                if (target == null) {
                    // ignore?
                }
                else {
                    property.removeTarget(source, target, autoConnectReverse);
                }

                return false;
            }

            public boolean visitToOne(ToOneProperty property) {
                property.setTarget(source, null, false);
                return false;
            }
        });
    }
View Full Code Here

                if (descriptor == null) {
                    throw new EJBQLException("Unmapped id variable: " + id);
                }
                String pathChunk = translator.lastPathComponent;

                Property property = descriptor.getProperty(pathChunk);
                if (property instanceof AttributeProperty) {
                    String atrType = ((AttributeProperty) property)
                            .getAttribute()
                            .getType();
View Full Code Here

            ArcOperation arcDiff = (ArcOperation) diff;
            Object targetId = arcDiff.getTargetNodeId();
            String arcId = arcDiff.getArcId().toString();

            Property property = getClassDescriptor().getProperty(arcId);

            // note that some collection properties implement 'SingleObjectArcProperty',
            // so we cant't do 'instanceof SingleObjectArcProperty'
            // TODO: andrus, 3.22.2006 - should we consider this a bug?

            if (property instanceof ToManyProperty) {

                // record flattened op changes
                ObjEntity entity = object
                        .getObjectContext()
                        .getEntityResolver()
                        .getObjEntity(entityName);

                ObjRelationship relationship = (ObjRelationship) entity
                        .getRelationship(property.getName());
                if (relationship.isFlattened()) {

                    if (flatIds == null) {
                        flatIds = new HashMap();
                    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.reflect.Property

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.