public class CopyGroup extends AttributeGroup
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:
Session#copy(Object, CopyGroup)
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
CASCADE_ALL_PARTS
Depth level indicating that all relationships with mappings should be used when
building the copied object graph
|
static int |
CASCADE_PRIVATE_PARTS
Depth level indicating that only relationships with mapping indicated privately-
owned should be copied
|
static int |
CASCADE_TREE
Depth level indicating that only the attributes found in the attribute group should be copied
|
protected java.util.Map |
copies |
protected int |
depth
Policy depth that determines how the copy will cascade to the object's
related parts
|
static int |
NO_CASCADE
Depth level indicating that NO relationships should be included in the copy.
|
protected org.eclipse.persistence.internal.sessions.AbstractSession |
session |
protected boolean |
shouldResetPrimaryKey |
protected boolean |
shouldResetVersion |
allsubclasses, isValidated, items, name, subClasses, superClassGroup, type, typeName
Constructor and Description |
---|
CopyGroup()
PUBLIC:
By default only copy the attributes found in the attribute group and don't null primary keys.
|
CopyGroup(java.lang.String name)
PUBLIC:
By default only copy the attributes found in the attribute group and don't null primary keys.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(java.lang.String attributeNameOrPath,
CopyGroup group) |
void |
addAttribute(java.lang.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 |
cascadeAllParts()
PUBLIC:
Set if the copy should cascade all relationships when copying the object(s).
|
void |
cascadePrivateParts()
PUBLIC:
Set if the copy should cascade only those relationships that are configured
as privately-owned.
|
void |
cascadeTree()
PUBLIC:
Set if the copy should cascade only those attributes that are found in the group.
|
CopyGroup |
clone() |
void |
dontCascade()
PUBLIC:
Set if the copy should not cascade relationships when copying the object(s)
|
java.util.Map |
getCopies()
INTERNAL: Get the session.
|
int |
getDepth()
INTERNAL: Return the cascade depth.
|
CopyGroup |
getGroup(java.lang.String attributeNameOrPath)
Returns CopyGroup corresponding to the passed (possibly nested) attribute.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession()
INTERNAL: Return the session.
|
boolean |
isCopyGroup()
INTERNAL:
This method is used internally when converting to a copy group.
|
protected CopyGroup |
newGroup(java.lang.String name,
CoreAttributeGroup parent)
Subclass may create different types.
|
void |
setCopies(java.util.Map newCopies)
INTERNAL: Set the copies.
|
void |
setDepth(int newDepth)
INTERNAL: Set the cascade depth.
|
void |
setSession(org.eclipse.persistence.internal.sessions.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 |
shouldCascade()
PUBLIC:
Return true if has been configured to CASCADE_ALL_PARTS or CASCADE_PRIVATE_PARTS.
|
boolean |
shouldCascadeAllParts()
PUBLIC:
Return true if should CASCADE_ALL_PARTS
|
boolean |
shouldCascadePrivateParts()
PUBLIC:
Return true if should CASCADE_PRIVATE_PARTS
|
boolean |
shouldCascadeTree()
PUBLIC:
Return true if should CASCADE_TREE
|
boolean |
shouldResetPrimaryKey()
PUBLIC:
Return if the primary key should be reset to null.
|
boolean |
shouldResetVersion()
PUBLIC:
Return if the version should be reset to null.
|
protected java.lang.String |
toStringAdditionalInfo()
INTERNAL:
|
addAttribute, findGroup, getItem, isConcurrent, isLoadGroup, isSupersetOf, newItem, newItem, toCopyGroup, toCopyGroup, toFetchGroup, toFetchGroup, toLoadGroup, toLoadGroup
addAttribute, addAttribute, addAttributeKey, addAttributes, clone, containsAttribute, containsAttributeInternal, convert, convertClassNamesToClasses, equals, getAllItems, getAttributeNames, getItem, getItems, getName, getSubClassGroups, getType, getTypeName, hasInheritance, hasItems, insertSubClass, isFetchGroup, isSupersetOf, isValidated, removeAttribute, setAllSubclasses, setAttributeNames, setName, toString, toStringItems, toStringPath
protected boolean shouldResetPrimaryKey
protected boolean shouldResetVersion
protected transient org.eclipse.persistence.internal.sessions.AbstractSession session
protected java.util.Map copies
protected int depth
public static final int NO_CASCADE
public static final int CASCADE_PRIVATE_PARTS
public static final int CASCADE_ALL_PARTS
public static final int CASCADE_TREE
public CopyGroup()
public CopyGroup(java.lang.String name)
public void cascadeAllParts()
public void cascadePrivateParts()
public void cascadeTree()
public void dontCascade()
public java.util.Map getCopies()
public int getDepth()
public org.eclipse.persistence.internal.sessions.AbstractSession getSession()
public void setCopies(java.util.Map newCopies)
public void setDepth(int newDepth)
public void setSession(org.eclipse.persistence.internal.sessions.AbstractSession newSession)
public void setShouldResetPrimaryKey(boolean newShouldResetPrimaryKey)
public void setShouldResetVersion(boolean newShouldResetVersion)
public boolean shouldCascade()
public boolean shouldCascadeAllParts()
public boolean shouldCascadePrivateParts()
public boolean shouldCascadeTree()
public boolean shouldResetPrimaryKey()
public boolean shouldResetVersion()
protected java.lang.String toStringAdditionalInfo()
toStringAdditionalInfo
in class CoreAttributeGroup<org.eclipse.persistence.internal.queries.AttributeItem>
public void addAttribute(java.lang.String attributeNameOrPath, CoreAttributeGroup group)
CoreAttributeGroup
Example:
group.addAttribute("firstName", group1);
Note that existing group corresponding to attributeNameOrPath
will be overridden with the passed group.
group.addAttribute("manager.address", group2);
addAttribute
in class CoreAttributeGroup<org.eclipse.persistence.internal.queries.AttributeItem>
group
- - an AttributeGroup to be added.public void addAttribute(java.lang.String attributeNameOrPath, CopyGroup group)
public boolean isCopyGroup()
AttributeGroup
isCopyGroup
in class AttributeGroup
public CopyGroup clone()
clone
in class AttributeGroup
public CopyGroup getGroup(java.lang.String attributeNameOrPath)
getGroup
in class AttributeGroup
protected CopyGroup newGroup(java.lang.String name, CoreAttributeGroup parent)
AttributeGroup
newGroup
in class AttributeGroup