org.apache.openjpa.kernel
Class AttachStrategy

java.lang.Object
  extended by org.apache.openjpa.kernel.TransferFieldManager
      extended by org.apache.openjpa.kernel.AttachStrategy
All Implemented Interfaces:
FieldConsumer, FieldManager, FieldSupplier
Direct Known Subclasses:
DetachedStateAttachStrategy, DetachedStateManager, VersionAttachStrategy

abstract class AttachStrategy
extends TransferFieldManager

Strategy for attaching objects.

Author:
Marc Prud'hommeaux, Steve Kim

Field Summary
 
Fields inherited from class org.apache.openjpa.kernel.TransferFieldManager
dblval, field, longval, objval
 
Constructor Summary
AttachStrategy()
           
 
Method Summary
abstract  Object attach(AttachManager manager, Object toAttach, ClassMetaData meta, PersistenceCapable into, OpenJPAStateManager owner, ValueMetaData ownerMeta, boolean explicit)
          Attach.
protected  Collection attachCollection(AttachManager manager, Collection orig, OpenJPAStateManager sm, FieldMetaData fmd)
          Return a new collection with the attached contents of the given one.
protected  boolean attachField(AttachManager manager, Object toAttach, StateManagerImpl sm, FieldMetaData fmd, boolean nullLoaded)
          Attach the given field into the given instance.
protected  Map attachMap(AttachManager manager, Map orig, OpenJPAStateManager sm, FieldMetaData fmd)
          Make sure all the values in the given map are attached.
protected abstract  Object getDetachedObjectId(AttachManager manager, Object toAttach)
          Return the identity of the given detached instance.
protected  Object getReference(AttachManager manager, Object toAttach, OpenJPAStateManager sm, ValueMetaData vmd)
          Return a managed, possibly hollow reference for the given detached object.
protected  StateManagerImpl persist(AttachManager manager, PersistenceCapable pc, ClassMetaData meta, Object appId, boolean explicit)
          Return a PNew/PNewProvisional managed object for the given detached instance.
protected abstract  void provideField(Object toAttach, StateManagerImpl sm, int field)
          Provide the given field into this field manager.
 
Methods inherited from class org.apache.openjpa.kernel.TransferFieldManager
clear, fetchBooleanField, fetchByteField, fetchCharField, fetchDoubleField, fetchFloatField, fetchIntField, fetchLongField, fetchObjectField, fetchShortField, fetchStringField, storeBooleanField, storeByteField, storeCharField, storeDoubleField, storeFloatField, storeIntField, storeLongField, storeObjectField, storeShortField, storeStringField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttachStrategy

AttachStrategy()
Method Detail

attach

public abstract Object attach(AttachManager manager,
                              Object toAttach,
                              ClassMetaData meta,
                              PersistenceCapable into,
                              OpenJPAStateManager owner,
                              ValueMetaData ownerMeta,
                              boolean explicit)
Attach.

Parameters:
manager - manager holding cache of attached instances
toAttach - detached instance
meta - metadata for the instance being attached
into - instance we're attaching into
owner - state manager for into
ownerMeta - field we traversed to find toAttach
explicit - whether to make new instances explicitly persistent

getDetachedObjectId

protected abstract Object getDetachedObjectId(AttachManager manager,
                                              Object toAttach)
Return the identity of the given detached instance.


provideField

protected abstract void provideField(Object toAttach,
                                     StateManagerImpl sm,
                                     int field)
Provide the given field into this field manager.


persist

protected StateManagerImpl persist(AttachManager manager,
                                   PersistenceCapable pc,
                                   ClassMetaData meta,
                                   Object appId,
                                   boolean explicit)
Return a PNew/PNewProvisional managed object for the given detached instance.


attachField

protected boolean attachField(AttachManager manager,
                              Object toAttach,
                              StateManagerImpl sm,
                              FieldMetaData fmd,
                              boolean nullLoaded)
Attach the given field into the given instance.

Parameters:
toAttach - the detached persistent instance
sm - state manager for the managed instance we're copying into; toAttach also uses this state manager
fmd - metadata on the field we're copying
nullLoaded - if false, nulls will be considered unloaded and will not be attached

getReference

protected Object getReference(AttachManager manager,
                              Object toAttach,
                              OpenJPAStateManager sm,
                              ValueMetaData vmd)
Return a managed, possibly hollow reference for the given detached object.


attachCollection

protected Collection attachCollection(AttachManager manager,
                                      Collection orig,
                                      OpenJPAStateManager sm,
                                      FieldMetaData fmd)
Return a new collection with the attached contents of the given one.


attachMap

protected Map attachMap(AttachManager manager,
                        Map orig,
                        OpenJPAStateManager sm,
                        FieldMetaData fmd)
Make sure all the values in the given map are attached.



Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.