Package org.apache.cayenne.property

Examples of org.apache.cayenne.property.Property


        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


        if (source != null && source.getPersistenceState() != PersistenceState.HOLLOW) {

            // get target as local object
            Object target = context.localObject((ObjectId) targetNodeId, null);

            Property p = propertyForId(nodeId, arcId.toString());
            if (p instanceof CollectionProperty) {
                ((CollectionProperty) p).addTarget(source, target, false);
            }
            else {
                ((SingleObjectArcProperty) p).setTarget(source, target, false);
View Full Code Here

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

            Object target = context.localObject((ObjectId) targetNodeId, null);

            Property p = propertyForId(nodeId, arcId.toString());
            if (p instanceof CollectionProperty) {
                ((CollectionProperty) p).removeTarget(source, target, false);
            }
            else {
                ((SingleObjectArcProperty) p).setTarget(source, null, false);
View Full Code Here

        Object object = context.internalGraphManager().getNode(nodeId);
        if (object != null) {

            // do not override local changes....
            Property p = propertyForId(nodeId, property);
            if (Util.nullSafeEquals(p.readPropertyDirectly(object), oldValue)) {

                p.writePropertyDirectly(object, oldValue, newValue);
                context.internalGraphAction().handleSimplePropertyChange(
                        (Persistent) object,
                        property,
                        oldValue,
                        newValue);
View Full Code Here

        // translate ObjectContext generic property change callback to GraphManager terms
        // (simple properties vs. relationships)

        ClassDescriptor descriptor = context.getEntityResolver().getClassDescriptor(
                object.getObjectId().getEntityName());
        Property property = descriptor.getProperty(propertyName);

        // relationship property
        if (property instanceof ArcProperty) {

            try {
View Full Code Here

        ObjRelationship relationship = (ObjRelationship) sourceEntity
                .getRelationship(relationshipName);
        ObjRelationship reverse = relationship.getReverseRelationship();

        if (reverse != null && !reverse.isToMany()) {
            Property property = resolver
                    .getClassDescriptor(reverse.getSourceEntity().getName())
                    .getProperty(reverse.getName());

            Iterator it = resolved.iterator();
            while (it.hasNext()) {
                property.writePropertyDirectly(it.next(), null, relationshipOwner);
            }
        }

        return resolved;
    }
View Full Code Here

            ObjRelationship relationship = (ObjRelationship) it.next();
            ClassDescriptor targetDescriptor = resolver.getClassDescriptor(relationship
                    .getTargetEntityName());
            String reverseName = relationship.getReverseRelationshipName();

            Property property;
            if (relationship.isToMany()) {

                PropertyAccessor accessor = makeAccessor(
                        relationship.getName(),
                        List.class);
View Full Code Here

                return true;
            }

            public boolean visitProperty(Property property) {
                Property targetProperty = targetDescriptor
                        .getProperty(property.getName());
                targetProperty.writeProperty(target, null, property.readProperty(source));
                return true;
            }

        });
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 CollectionProperty) {

                // record flattened op changes
                ObjEntity entity = objectStore.context.getEntityResolver().getObjEntity(
                        entityName);

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

                    if (flatIds == null) {
                        flatIds = new HashMap();
                    }
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

TOP

Related Classes of org.apache.cayenne.property.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.