Package org.apache.cayenne.property

Examples of org.apache.cayenne.property.SingleObjectArcProperty


                        Object destinationTarget = destinationSource != null ? detach(
                                destinationSource,
                                property.getTargetDescriptor(),
                                child) : null;

                        SingleObjectArcProperty targetProperty = (SingleObjectArcProperty) targetDescriptor
                                .getProperty(property.getName());
                        Object oldTarget = targetProperty.isFault(target)
                                ? null
                                : targetProperty.readProperty(target);
                        targetProperty
                                .writeProperty(target, oldTarget, destinationTarget);
                    }
                }

                return true;
            }

            public boolean visitCollectionArc(CollectionProperty property) {
                if (prefetchTree != null) {
                    PrefetchTreeNode child = prefetchTree.getNode(property.getName());

                    if (child != null) {
                        Collection collection = (Collection) property
                                .readProperty(source);

                        Collection targetCollection = new ArrayList(collection.size());

                        Iterator it = collection.iterator();
                        while (it.hasNext()) {
                            Object destinationSource = it.next();
                            Object destinationTarget = destinationSource != null
                                    ? detach(destinationSource, property
                                            .getTargetDescriptor(), child)
                                    : null;

                            targetCollection.add(destinationTarget);
                        }

                        CollectionProperty targetProperty = (CollectionProperty) targetDescriptor
                                .getProperty(property.getName());
                        targetProperty.writeProperty(target, null, targetCollection);
                    }
                }

                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

TOP

Related Classes of org.apache.cayenne.property.SingleObjectArcProperty

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.