org.jpox
Class FetchPlanImpl

java.lang.Object
  extended byorg.jpox.FetchPlanImpl
All Implemented Interfaces:
javax.jdo.FetchPlan, java.io.Serializable

public class FetchPlanImpl
extends java.lang.Object
implements javax.jdo.FetchPlan, java.io.Serializable

This class implements the FetchPlan interface. In addition to the FetchPlan interface implementation, this class updates and provides for each class managed the fields correspondent to the actual fetch plan. A fetch group defines a particular loaded state for an object graph. It specifies fields to be loaded for all of the instances in the graph. Fetch groups are activated using methods on an interface called FetchPlan. FetchPlan interface is provided to user and enables him add, remove or reset the active groups in the fetch plan

Since:
1.1
Version:
$Revision: 1.46 $
See Also:
Serialized Form

Nested Class Summary
 class FetchPlanImpl.FetchPlanForClass
          Class managing the fetch plan for a particular class.
 
Field Summary
protected static Localiser LOCALISER
          Localisation utility for output messages
static java.lang.String NONE
          For use with addGroup, removeGroup, and the various setGroups methods.
 
Fields inherited from interface javax.jdo.FetchPlan
ALL, DEFAULT, DETACH_LOAD_FIELDS, DETACH_UNLOAD_FIELDS, FETCH_SIZE_GREEDY, FETCH_SIZE_OPTIMAL
 
Constructor Summary
FetchPlanImpl()
          Constructor.
 
Method Summary
 javax.jdo.FetchPlan addGroup(java.lang.String fetchGroupName)
           
 javax.jdo.FetchPlan clearGroups()
          Method to clear the current groups and activate the DFG.
 javax.jdo.FetchPlan getCopy()
          Returns a copy of this FetchPlan with all settings initialized
 int getDetachmentOptions()
          Return the options to be used at detachment.
 java.lang.Class[] getDetachmentRootClasses()
          Accessor for the root classes of the detachment graph for DetachAllOnCommit.
 java.util.Collection getDetachmentRoots()
          Accessor for the roots of the detachment graph for DetachAllOnCommit.
 FetchPlanImpl.FetchPlanForClass getFetchPlanForClass(AbstractClassMetaData cmd)
          Access the fetch plan for the class
 int getFetchSize()
           
 java.util.Set getGroups()
          Accessor for the groups for this FetchPlan.
 int getMaxFetchDepth()
          Accessor for the maximum fetch depth.
 FetchPlanImpl.FetchPlanForClass manageFetchPlanForClass(AbstractClassMetaData cmd)
          Manage the fetch plan for the class
 javax.jdo.FetchPlan removeGroup(java.lang.String fetchGroupName)
           
 javax.jdo.FetchPlan setDetachmentOptions(int options)
          Set the options to be used at detachment.
 javax.jdo.FetchPlan setDetachmentRootClasses(java.lang.Class[] rootClasses)
          Set the classes used for roots of the detachment graph for DetachAllOnCommit.
 javax.jdo.FetchPlan setDetachmentRoots(java.util.Collection roots)
          Set the roots for DetachAllOnCommit
 javax.jdo.FetchPlan setFetchSize(int fetchSize)
           
 javax.jdo.FetchPlan setGroup(java.lang.String fetchGroupName)
          Method to set the fetch group.
 javax.jdo.FetchPlan setGroups(java.util.Collection fetchGroupNames)
           
 javax.jdo.FetchPlan setGroups(java.lang.String[] fetchGroupNames)
          Method to set the groups using an array.
 javax.jdo.FetchPlan setMaxFetchDepth(int max)
          Mutator for the maximum fetch depth where -1 implies no restriction on the fetch depth and 0 is invalid and throws a JDOUserException.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localisation utility for output messages


NONE

public static final java.lang.String NONE
For use with addGroup, removeGroup, and the various setGroups methods. Value: none. Was originally part of JDO 2 spec, but was dropped before final release. Included here for convenient way of getting back to no fields.

See Also:
Constant Field Values
Constructor Detail

FetchPlanImpl

public FetchPlanImpl()
Constructor. Initially has the default fetch group.

Method Detail

manageFetchPlanForClass

public FetchPlanImpl.FetchPlanForClass manageFetchPlanForClass(AbstractClassMetaData cmd)
Manage the fetch plan for the class

Parameters:
cmd - AbstractClassMetaData for the class to manage
Returns:
the FetchPlanForClass

getFetchPlanForClass

public FetchPlanImpl.FetchPlanForClass getFetchPlanForClass(AbstractClassMetaData cmd)
Access the fetch plan for the class

Parameters:
cmd - the AbstractClassMetaData
Returns:
the FetchPlanForClass

addGroup

public javax.jdo.FetchPlan addGroup(java.lang.String fetchGroupName)
Specified by:
addGroup in interface javax.jdo.FetchPlan

removeGroup

public javax.jdo.FetchPlan removeGroup(java.lang.String fetchGroupName)
Specified by:
removeGroup in interface javax.jdo.FetchPlan

clearGroups

public javax.jdo.FetchPlan clearGroups()
Method to clear the current groups and activate the DFG.

Specified by:
clearGroups in interface javax.jdo.FetchPlan
Returns:
The FetchPlan
See Also:
FetchPlan.clearGroups()

getGroups

public java.util.Set getGroups()
Accessor for the groups for this FetchPlan.

Specified by:
getGroups in interface javax.jdo.FetchPlan
Returns:
The fetch plan groups (unmodifiable)

setGroups

public javax.jdo.FetchPlan setGroups(java.util.Collection fetchGroupNames)
Specified by:
setGroups in interface javax.jdo.FetchPlan

setGroups

public javax.jdo.FetchPlan setGroups(java.lang.String[] fetchGroupNames)
Method to set the groups using an array.

Specified by:
setGroups in interface javax.jdo.FetchPlan
Parameters:
fetchGroupNames - Names of the fetch groups
Returns:
The Fetch Plan

setGroup

public javax.jdo.FetchPlan setGroup(java.lang.String fetchGroupName)
Method to set the fetch group.

Specified by:
setGroup in interface javax.jdo.FetchPlan
Parameters:
fetchGroupName - Name of the fetch group
Returns:
The Fetch Plan
See Also:
FetchPlan.setGroup(java.lang.String)

setDetachmentRoots

public javax.jdo.FetchPlan setDetachmentRoots(java.util.Collection roots)
Set the roots for DetachAllOnCommit

Specified by:
setDetachmentRoots in interface javax.jdo.FetchPlan
Parameters:
roots - The roots of the detachment graph.
Returns:
The fetch plan with these roots

getDetachmentRoots

public java.util.Collection getDetachmentRoots()
Accessor for the roots of the detachment graph for DetachAllOnCommit.

Specified by:
getDetachmentRoots in interface javax.jdo.FetchPlan
Returns:
The roots of the detachment graph.

setDetachmentRootClasses

public javax.jdo.FetchPlan setDetachmentRootClasses(java.lang.Class[] rootClasses)
Set the classes used for roots of the detachment graph for DetachAllOnCommit.

Specified by:
setDetachmentRootClasses in interface javax.jdo.FetchPlan
Parameters:
rootClasses - Classes to be used as roots of the detachment graph
Returns:
The fetch plan with these roots

getDetachmentRootClasses

public java.lang.Class[] getDetachmentRootClasses()
Accessor for the root classes of the detachment graph for DetachAllOnCommit.

Specified by:
getDetachmentRootClasses in interface javax.jdo.FetchPlan
Returns:
The classes to be used as the root of the detachment graph.

setMaxFetchDepth

public javax.jdo.FetchPlan setMaxFetchDepth(int max)
Mutator for the maximum fetch depth where -1 implies no restriction on the fetch depth and 0 is invalid and throws a JDOUserException.

Specified by:
setMaxFetchDepth in interface javax.jdo.FetchPlan
Parameters:
max - The maximum fetch depth to fetch to

getMaxFetchDepth

public int getMaxFetchDepth()
Accessor for the maximum fetch depth.

Specified by:
getMaxFetchDepth in interface javax.jdo.FetchPlan
Returns:
The maximum fetch depth

setFetchSize

public javax.jdo.FetchPlan setFetchSize(int fetchSize)
Specified by:
setFetchSize in interface javax.jdo.FetchPlan

getFetchSize

public int getFetchSize()
Specified by:
getFetchSize in interface javax.jdo.FetchPlan

getDetachmentOptions

public int getDetachmentOptions()
Return the options to be used at detachment.

Specified by:
getDetachmentOptions in interface javax.jdo.FetchPlan
Returns:
Detachment options

setDetachmentOptions

public javax.jdo.FetchPlan setDetachmentOptions(int options)
Set the options to be used at detachment.

Specified by:
setDetachmentOptions in interface javax.jdo.FetchPlan
Parameters:
options - The options
Returns:
The updated fetch plan.

toString

public java.lang.String toString()

getCopy

public javax.jdo.FetchPlan getCopy()
Returns a copy of this FetchPlan with all settings initialized

Returns:
the FetchPlan


Copyright © -2007 . All Rights Reserved.