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
FieldsModifier and TypeFieldDescriptionstatic final intDepth level indicating that all relationships with mappings should be used when building the copied object graphstatic final intDepth level indicating that only relationships with mapping indicated privately- owned should be copiedstatic final intDepth level indicating that only the attributes found in the attribute group should be copiedprotected Mapprotected intPolicy depth that determines how the copy will cascade to the object's related partsstatic final intDepth level indicating that NO relationships should be included in the copy.protected AbstractSessionprotected booleanprotected booleanFields inherited from class org.eclipse.persistence.core.queries.CoreAttributeGroup
allsubclasses, isValidated, items, name, subClasses, superClassGroup, type, typeName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(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.voidaddAttribute(String attributeNameOrPath, CopyGroup group) voidPUBLIC: Set if the copy should cascade all relationships when copying the object(s).voidPUBLIC: Set if the copy should cascade only those relationships that are configured as privately-owned.voidPUBLIC: Set if the copy should cascade only those attributes that are found in the group.clone()voidPUBLIC: Set if the copy should not cascade relationships when copying the object(s)INTERNAL: Get the session.intgetDepth()INTERNAL: Return the cascade depth.Returns CopyGroup corresponding to the passed (possibly nested) attribute.INTERNAL: Return the session.booleanINTERNAL: This method is used internally when converting to a copy group.protected CopyGroupnewGroup(String name, CoreAttributeGroup parent) Subclass may create different types.voidINTERNAL: Set the copies.voidsetDepth(int newDepth) INTERNAL: Set the cascade depth.voidsetSession(AbstractSession newSession) INTERNAL: Set the session.voidsetShouldResetPrimaryKey(boolean newShouldResetPrimaryKey) PUBLIC: Set if the primary key should be reset to null.voidsetShouldResetVersion(boolean newShouldResetVersion) PUBLIC: Set if the version should be reset to null.booleanPUBLIC: Return true if has been configured to CASCADE_ALL_PARTS or CASCADE_PRIVATE_PARTS.booleanPUBLIC: Return true if should CASCADE_ALL_PARTSbooleanPUBLIC: Return true if should CASCADE_PRIVATE_PARTSbooleanPUBLIC: Return true if should CASCADE_TREEbooleanPUBLIC: Return if the primary key should be reset to null.booleanPUBLIC: Return if the version should be reset to null.protected StringINTERNAL:Methods inherited from class org.eclipse.persistence.queries.AttributeGroup
addAttribute, findGroup, getItem, isConcurrent, isLoadGroup, isSupersetOf, newItem, newItem, toCopyGroup, toCopyGroup, toFetchGroup, toFetchGroup, toLoadGroup, toLoadGroupMethods 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:
toStringAdditionalInfoin classCoreAttributeGroup<AttributeItem,ClassDescriptor>
-
addAttribute
Description copied from class:CoreAttributeGroupAdd 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:
addAttributein 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:AttributeGroupINTERNAL: This method is used internally when converting to a copy group.- Overrides:
isCopyGroupin classAttributeGroup
-
clone
- Overrides:
clonein classAttributeGroup
-
getGroup
Returns CopyGroup corresponding to the passed (possibly nested) attribute.- Overrides:
getGroupin classAttributeGroup
-
newGroup
Description copied from class:AttributeGroupSubclass may create different types.- Overrides:
newGroupin classAttributeGroup
-