Examples of CollectionProxy


Examples of org.apache.ojb.broker.core.proxy.CollectionProxy

        query.create("select books from " + Book.class.getName() + " where title like $1");
        query.bind(name);
        Collection result = (Collection) query.execute();
        assertEquals(1, result.size());
        Book b = (Book) result.iterator().next();
        CollectionProxy handler = ProxyHelper.getCollectionProxy(b.getReviews());
        assertFalse("Don't expect an materialized collection proxy", handler.isLoaded());
        handler.addListener(new CollectionProxyListener()
        {
            public void beforeLoading(CollectionProxyDefaultImpl colProxy)
            {
                fail("Collection proxy shouldn't be materialized");
            }
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.CollectionProxy

        {
            CollectionDescriptor cds = (CollectionDescriptor) i.next();
            Object col = cds.getPersistentField().get(newTxObject);
            if (col != null)
            {
                CollectionProxy proxy = ProxyHelper.getCollectionProxy(col);
                if (proxy != null)
                {
                    if (!proxy.isLoaded())
                    {
                        if (log.isDebugEnabled()) log.debug("adding self as listener to collection proxy");
                        proxy.addListener(this);
                        continue;
                    }
                }
                Iterator colIterator = BrokerHelper.getCollectionIterator(col);
                // get foreign info for collection elements
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.CollectionProxy

            }
        }

        void assignReferenceObject(Object collOrArray)
        {
            CollectionProxy colProxy = ProxyHelper.getCollectionProxy(collOrArray);
            if(colProxy != null)
            {
                if(colProxy.isLoaded())
                {
                    status = IS_MATERIALIZED_PROXY;
                    /*
                    TODO: avoid dependency to CollectionProxyDefaultImpl
                    e.g. change CollectionProxy interface - CollectionProxy should
                    extend Collection to support Iterator
                    */
                    handleCollectionOrArray(((CollectionProxyDefaultImpl) colProxy).getData());
                }
                else
                {
                    status = IS_UNMATERIALIZED_PROXY;
// TODO: ObjectEnvelopeTable#register take care of proxy objects/collection, no need to handle proxy objects??
                    colProxy.addListener(this);
                    collectionHandler = colProxy;
                }
            }
            else
            {
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.CollectionProxy

            {
                CollectionDescriptor cds = (CollectionDescriptor) i.next();
                Object col = cds.getPersistentField().get(sourceObject);
                if (col != null)
                {
                    CollectionProxy proxy = ProxyHelper.getCollectionProxy(col);
                    if (proxy != null)
                    {
                        if (!proxy.isLoaded())
                        {
                            if (log.isDebugEnabled()) log.debug("adding self as listener to collection proxy");
                            proxy.addListener(this);
                            registeredCollectionProxies.add(proxy);
                            continue;
                        }
                    }
                    Iterator colIterator = BrokerHelper.getCollectionIterator(col);
View Full Code Here

Examples of org.apache.ojb.broker.core.proxy.CollectionProxy

        // PersistenceBroker pb = getTransaction().getBroker();
        for(int i = 0; i < descriptor.size(); i++)
        {
            CollectionDescriptor col = (CollectionDescriptor) descriptor.get(i);
            Object collOrArray = col.getPersistentField().get(source.getObject());
            CollectionProxy proxy = ProxyHelper.getCollectionProxy(collOrArray);
            /*
            on insert we perform only materialized collection objects. This should be
            sufficient, because in method #cascadingDependents() we make sure that on
            move of unmaterialized collection objects the proxy was materialized if needed.
            */
 
View Full Code Here

Examples of org.castor.persist.proxy.CollectionProxy

                        arrayValue[j] = tx.fetch(fieldClassMolder, (Identity) v.get(j), null);
                    }
                    _fieldMolder.setValue(object, arrayValue, tx
                            .getClassLoader());
                } else {
                    CollectionProxy cp = CollectionProxy.create(_fieldMolder,
                            object, tx.getClassLoader());
                    // clear collection
                    _fieldMolder.setValue(object, cp.getCollection(), tx
                            .getClassLoader());

                    for (int j = 0; j < v.size(); j++) {
                        Object obj = tx.fetch(fieldClassMolder, (Identity) v.get(j), null);
                        if (obj != null) {
                            cp.add((Identity) v.get(j), obj);
                        }
                    }
                    cp.close();
                    // fieldMolder.setValue( object, cp.getCollection() );
                }
            } else {
                _fieldMolder.setValue(object, null, tx.getClassLoader());
            }
View Full Code Here

Examples of org.castor.persist.proxy.CollectionProxy

                        value[j] = tx.load((Identity) v.get(j), proposedValue, suggestedAccessMode);
                    }
                    _fieldMolder.setValue(proposedObject.getEntity(), value, tx
                            .getClassLoader());
                } else {
                    CollectionProxy cp = CollectionProxy.create(_fieldMolder,
                            proposedObject.getEntity(), tx.getClassLoader());
                    for (int j = 0; j < v.size(); j++) {
                        ProposedEntity proposedValue = new ProposedEntity(fieldClassMolder);
                        cp.add((Identity) v.get(j), tx.load((Identity) v.get(j),
                                proposedValue, suggestedAccessMode));
                    }
                    cp.close();
                }
            } else {
                _fieldMolder.setValue(proposedObject.getEntity(), null, tx
                        .getClassLoader());
            }
View Full Code Here

Examples of org.fjank.jcache.collection.CollectionProxy

    public Set keySet() {
        return new SetProxy(weakReferenceObjects.keySet(), this);
    }

    public Collection values() {
        return new CollectionProxy(weakReferenceObjects.values(), this);
    }
View Full Code Here

Examples of org.xorm.CollectionProxy

    private Object getCollectionProxy(BoundExpression bound) {
        FetchGroupManager fgm = XORM.getFetchGroupManager(mgr);
        ClassMapping mapping = XORM.getModelMapping(mgr).getClassMapping(query.getCandidateClass());
        Selector selector = bound.getSelector();
        selector.require(fgm.getDataFetchGroup(mapping));
        CollectionProxy cp = new CollectionProxy(mgr, mapping, selector);
        openResults.add(cp);
        return cp;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.