Examples of ObjectCopyStrategy


Examples of org.apache.ojb.otm.copy.ObjectCopyStrategy

            // first insertion of the userObject into editing context
            Object swizzledObject = swizzlingStrategy.swizzle(userObject, null, _pb, this);
            entry = new ContextEntry(swizzledObject);
            if (entry.handler != null)
            {
                ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
                entry.cacheObject = copyStrategy.copy(userObject, _pb);
                // Assume that object exists, otherwise were the proxy came from?
                _objects.put(oid, entry);
                lockManager.ensureLock(oid, _tx, lock, _pb); // lock after _objects.put to avoid hanged locks
                entry.handler.addListener(this);
            }
            else
            {
                Object origCacheObj = _pb.getObjectByIdentity(oid);

                if ((origCacheObj == null) && !canCreate)
                {
                    // we don't create the objects by reachability
                    throw new IllegalStateException("Related object is neither persistent, nor otm-depentent: " + oid);
                }
                if (origCacheObj != null)
                {
                    entry.cacheObject = origCacheObj;
                }
                buildingObject = true;
                _objects.put(oid, entry);
                lockManager.ensureLock(oid, _tx, lock, _pb); // lock after _objects.put to avoid hanged locks

                if (userObject != null)
                {
                    if ((origCacheObj == null) && canCreate)
                    {
                        ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
                        entry.cacheObject = copyStrategy.copy(userObject, _pb);
                        entry.state = State.PERSISTENT_NEW;
                        if (kit.isEagerInsert(userObject)
                                || hasBidirectionalAssociation(userObject.getClass()))
                        {
                            _pb.store(entry.cacheObject, entry.state);
View Full Code Here

Examples of org.apache.ojb.otm.copy.ObjectCopyStrategy

        {
            return;
        }

        int lock = LockManager.getInstance().getLockHeld(oid, _tx);
        ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
        Object userObject = copyStrategy.copy(cacheObject, _pb);
        handler.setRealSubject(userObject);
        _original.put(oid, getFields(userObject, false, true));

        // replace the proxy object with the real one
        entry.userObject = userObject;
View Full Code Here

Examples of org.apache.ojb.otm.copy.ObjectCopyStrategy

                {
                    relUserObj = entry.userObject;
                }
                else
                {
                    ObjectCopyStrategy copyStrategy;

                    copyStrategy = _tx.getKit().getCopyStrategy(relOid);
                    relUserObj = copyStrategy.copy(relCacheObj, _pb);
                    try
                    {
                        entry = insertInternal(relOid, relUserObj, _lock,
                                _cds.getOtmDependent(), null, new Stack());
                        if (entry != null)
View Full Code Here

Examples of org.apache.ojb.otm.copy.ObjectCopyStrategy

        {
            // The object exists in the database, but is not yet in the editing
            // context, so we need to put it to the editing context in its
            // old state, then we will put the modified userObject.
            // This will allow the editing context to find changes
            ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
            Object origUserObject = copyStrategy.copy(cacheObject, _pb);
            _editingContext.insert(oid, origUserObject, LockType.WRITE_LOCK);
        }
        _editingContext.insert(oid, userObject, LockType.WRITE_LOCK);
    }
View Full Code Here

Examples of org.apache.ojb.otm.copy.ObjectCopyStrategy

        {
            if (_editingContext.lookup(oid) == null)
            {
                // The object exists in the database, but is not yet in the editing
                // context, so we need to put it to the editing context
                ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
                Object origUserObject = copyStrategy.copy(cacheObject, _pb);
                _editingContext.insert(oid, origUserObject, LockType.WRITE_LOCK);
            }
            _editingContext.deletePersistent(oid, userObject);
        }
    }
View Full Code Here

Examples of org.apache.ojb.otm.copy.ObjectCopyStrategy

    {
        Object userObject = _editingContext.lookup(oid);

        if (userObject == null)
        {
            ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
            userObject = copyStrategy.copy(cacheObject, _pb);
        }
        return userObject;
    }
View Full Code Here

Examples of org.apache.ojb.otm.copy.ObjectCopyStrategy

        {
            // The object exists in the database, but is not yet in the editing
            // context, so we need to put it to the editing context in its
            // old state, then we will put the modified userObject.
            // This will allow the editing context to find changes
            ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
            Object origUserObject = copyStrategy.copy(cacheObject, _pb);
            _editingContext.insert(oid, origUserObject, LockType.WRITE_LOCK);
        }
        _editingContext.insert(oid, userObject, LockType.WRITE_LOCK);
    }
View Full Code Here

Examples of org.apache.ojb.otm.copy.ObjectCopyStrategy

        {
            if (_editingContext.lookup(oid) == null)
            {
                // The object exists in the database, but is not yet in the editing
                // context, so we need to put it to the editing context
                ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
                Object origUserObject = copyStrategy.copy(cacheObject, _pb);
                _editingContext.insert(oid, origUserObject, LockType.WRITE_LOCK);
            }
            _editingContext.deletePersistent(oid, userObject);
        }
    }
View Full Code Here

Examples of org.apache.ojb.otm.copy.ObjectCopyStrategy

    {
        Object userObject = _editingContext.lookup(oid);

        if (userObject == null)
        {
            ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
            userObject = copyStrategy.copy(cacheObject, _pb);
        }
        return userObject;
    }
View Full Code Here

Examples of org.apache.ojb.otm.copy.ObjectCopyStrategy

            // first insertion of the userObject into editing context
            Object swizzledObject = swizzlingStrategy.swizzle(userObject, null, _pb, this);
            entry = new ContextEntry(swizzledObject);
            if (entry.handler != null)
            {
                ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
                entry.cacheObject = copyStrategy.copy(userObject, _pb);
                // Assume that object exists, otherwise were the proxy came from?
                _objects.put(oid, entry);
                lockManager.ensureLock(oid, _tx, lock, _pb); // lock after _objects.put to avoid hanged locks
                entry.handler.addListener(this);
            }
            else
            {
                Object origCacheObj = _pb.getObjectByIdentity(oid);

                if ((origCacheObj == null) && !canCreate)
                {
                    // we don't create the objects by reachability
                    throw new IllegalStateException("Related object is neither persistent, nor otm-depentent: " + oid);
                }
                if (origCacheObj != null)
                {
                    entry.cacheObject = origCacheObj;
                }
                buildingObject = true;
                _objects.put(oid, entry);
                lockManager.ensureLock(oid, _tx, lock, _pb); // lock after _objects.put to avoid hanged locks

                if (userObject != null)
                {
                    if ((origCacheObj == null) && canCreate)
                    {
                        ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
                        entry.cacheObject = copyStrategy.copy(userObject, _pb);
                        entry.state = State.PERSISTENT_NEW;
                        if (kit.isEagerInsert(userObject)
                                || hasBidirectionalAssociation(userObject.getClass()))
                        {
                            _pb.store(entry.cacheObject, entry.state);
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.