java.lang.Object
org.eclipse.persistence.core.queries.CoreAttributeGroup<AttributeItem,ClassDescriptor>
org.eclipse.persistence.queries.AttributeGroup
org.eclipse.persistence.sessions.CopyGroup
- All Implemented Interfaces:
Serializable
,Cloneable
Purpose: Define how an object is to be copied.
Description: This is for usage with the object copying feature, not the unit of work. This is useful for copying an entire object graph as part of the host application's logic.
Responsibilities:
- Indicate through CASCADE levels the depth relationships will copied.
- Indicate if PK attributes should be copied with existing value or should be reset.
- Copies only the attributes found in the group.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Depth level indicating that all relationships with mappings should be used when building the copied object graphstatic final int
Depth level indicating that only relationships with mapping indicated privately- owned should be copiedstatic final int
Depth level indicating that only the attributes found in the attribute group should be copiedprotected Map
protected int
Policy depth that determines how the copy will cascade to the object's related partsstatic final int
Depth level indicating that NO relationships should be included in the copy.protected AbstractSession
protected boolean
protected boolean
Fields inherited from class org.eclipse.persistence.core.queries.CoreAttributeGroup
allsubclasses, isValidated, items, name, subClasses, superClassGroup, type, typeName
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(String attributeNameOrPath, CoreAttributeGroup group) Add a basic attribute or nested attribute with each String representing an attribute on the path to what needs to be included in the AttributeGroup.void
addAttribute
(String attributeNameOrPath, CopyGroup group) void
PUBLIC: Set if the copy should cascade all relationships when copying the object(s).void
PUBLIC: Set if the copy should cascade only those relationships that are configured as privately-owned.void
PUBLIC: Set if the copy should cascade only those attributes that are found in the group.clone()
void
PUBLIC: Set if the copy should not cascade relationships when copying the object(s)INTERNAL: Get the session.int
getDepth()
INTERNAL: Return the cascade depth.Returns CopyGroup corresponding to the passed (possibly nested) attribute.INTERNAL: Return the session.boolean
INTERNAL: This method is used internally when converting to a copy group.protected CopyGroup
newGroup
(String name, CoreAttributeGroup parent) Subclass may create different types.void
INTERNAL: Set the copies.void
setDepth
(int newDepth) INTERNAL: Set the cascade depth.void
setSession
(AbstractSession newSession) INTERNAL: Set the session.void
setShouldResetPrimaryKey
(boolean newShouldResetPrimaryKey) PUBLIC: Set if the primary key should be reset to null.void
setShouldResetVersion
(boolean newShouldResetVersion) PUBLIC: Set if the version should be reset to null.boolean
PUBLIC: Return true if has been configured to CASCADE_ALL_PARTS or CASCADE_PRIVATE_PARTS.boolean
PUBLIC: Return true if should CASCADE_ALL_PARTSboolean
PUBLIC: Return true if should CASCADE_PRIVATE_PARTSboolean
PUBLIC: Return true if should CASCADE_TREEboolean
PUBLIC: Return if the primary key should be reset to null.boolean
PUBLIC: Return if the version should be reset to null.protected String
INTERNAL:Methods inherited from class org.eclipse.persistence.queries.AttributeGroup
addAttribute, findGroup, getItem, isConcurrent, isLoadGroup, isSupersetOf, newItem, newItem, toCopyGroup, toCopyGroup, toFetchGroup, toFetchGroup, toLoadGroup, toLoadGroup
Methods inherited from class org.eclipse.persistence.core.queries.CoreAttributeGroup
addAttribute, addAttribute, addAttributeKey, addAttributes, clone, containsAttribute, containsAttributeInternal, convert, convertClassNamesToClasses, equals, getAllItems, getAttributeNames, getItem, getItems, getName, getSubClassGroups, getType, getTypeName, hashCode, hasInheritance, hasItems, insertSubClass, isFetchGroup, isSupersetOf, isValidated, removeAttribute, setAllSubclasses, setAttributeNames, setName, toString, toStringItems, toStringPath
-
Field Details
-
shouldResetPrimaryKey
protected boolean shouldResetPrimaryKey -
shouldResetVersion
protected boolean shouldResetVersion -
session
-
copies
-
depth
protected int depthPolicy depth that determines how the copy will cascade to the object's related parts -
NO_CASCADE
public static final int NO_CASCADEDepth level indicating that NO relationships should be included in the copy. Relationships that are not copied will include the default value of the object's instantiation policy- See Also:
-
CASCADE_PRIVATE_PARTS
public static final int CASCADE_PRIVATE_PARTSDepth level indicating that only relationships with mapping indicated privately- owned should be copied- See Also:
-
CASCADE_ALL_PARTS
public static final int CASCADE_ALL_PARTSDepth level indicating that all relationships with mappings should be used when building the copied object graph- See Also:
-
CASCADE_TREE
public static final int CASCADE_TREEDepth level indicating that only the attributes found in the attribute group should be copied- See Also:
-
-
Constructor Details
-
CopyGroup
public CopyGroup()PUBLIC: By default only copy the attributes found in the attribute group and don't null primary keys. -
CopyGroup
PUBLIC: By default only copy the attributes found in the attribute group and don't null primary keys.
-
-
Method Details
-
cascadeAllParts
public void cascadeAllParts()PUBLIC: Set if the copy should cascade all relationships when copying the object(s). -
cascadePrivateParts
public void cascadePrivateParts()PUBLIC: Set if the copy should cascade only those relationships that are configured as privately-owned. -
cascadeTree
public void cascadeTree()PUBLIC: Set if the copy should cascade only those attributes that are found in the group. -
dontCascade
public void dontCascade()PUBLIC: Set if the copy should not cascade relationships when copying the object(s) -
getCopies
INTERNAL: Get the session. -
getDepth
public int getDepth()INTERNAL: Return the cascade depth. -
getSession
INTERNAL: Return the session. -
setCopies
INTERNAL: Set the copies. -
setDepth
public void setDepth(int newDepth) INTERNAL: Set the cascade depth. -
setSession
INTERNAL: Set the session. -
setShouldResetPrimaryKey
public void setShouldResetPrimaryKey(boolean newShouldResetPrimaryKey) PUBLIC: Set if the primary key should be reset to null. -
setShouldResetVersion
public void setShouldResetVersion(boolean newShouldResetVersion) PUBLIC: Set if the version should be reset to null. -
shouldCascade
public boolean shouldCascade()PUBLIC: Return true if has been configured to CASCADE_ALL_PARTS or CASCADE_PRIVATE_PARTS. -
shouldCascadeAllParts
public boolean shouldCascadeAllParts()PUBLIC: Return true if should CASCADE_ALL_PARTS -
shouldCascadePrivateParts
public boolean shouldCascadePrivateParts()PUBLIC: Return true if should CASCADE_PRIVATE_PARTS -
shouldCascadeTree
public boolean shouldCascadeTree()PUBLIC: Return true if should CASCADE_TREE -
shouldResetPrimaryKey
public boolean shouldResetPrimaryKey()PUBLIC: Return if the primary key should be reset to null. -
shouldResetVersion
public boolean shouldResetVersion()PUBLIC: Return if the version should be reset to null. -
toStringAdditionalInfo
INTERNAL:- Overrides:
toStringAdditionalInfo
in classCoreAttributeGroup<AttributeItem,
ClassDescriptor>
-
addAttribute
Description copied from class:CoreAttributeGroup
Add a basic attribute or nested attribute with each String representing an attribute on the path to what needs to be included in the AttributeGroup.Example:
group.addAttribute("firstName", group1);
Note that existing group corresponding to attributeNameOrPath will be overridden with the passed group.
group.addAttribute("manager.address", group2);- Overrides:
addAttribute
in classCoreAttributeGroup<AttributeItem,
ClassDescriptor> - Parameters:
attributeNameOrPath
- A simple attribute, array or attributes forming a pathgroup
- - an AttributeGroup to be added.
-
addAttribute
-
isCopyGroup
public boolean isCopyGroup()Description copied from class:AttributeGroup
INTERNAL: This method is used internally when converting to a copy group.- Overrides:
isCopyGroup
in classAttributeGroup
-
clone
- Overrides:
clone
in classAttributeGroup
-
getGroup
Returns CopyGroup corresponding to the passed (possibly nested) attribute.- Overrides:
getGroup
in classAttributeGroup
-
newGroup
Description copied from class:AttributeGroup
Subclass may create different types.- Overrides:
newGroup
in classAttributeGroup
-