Top Description Fields Constructors Methods
org.eclipse.persistence.sessions

public Class CopyGroup

extends AttributeGroup
Class Inheritance
Imports
java.util.*, org.eclipse.persistence.core.queries.CoreAttributeGroup, org.eclipse.persistence.internal.localization.*, org.eclipse.persistence.queries.AttributeGroup

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:

See Also
Session#copy(Object, AttributeGroup)

Field Summary

Modifier and TypeField and Description
public static final int
CASCADE_ALL_PARTS

Depth level indicating that all relationships with mappings should be used when building the copied object graph

public static final int
CASCADE_PRIVATE_PARTS

Depth level indicating that only relationships with mapping indicated privately- owned should be copied

public static final int
CASCADE_TREE

Depth level indicating that only the attributes found in the attribute group should be copied

protected Map<K, V>
protected int
depth

Policy depth that determines how the copy will cascade to the object's related parts

public static final int
NO_CASCADE

Depth level indicating that NO relationships should be included in the copy.

protected transient AbstractSession
protected boolean
protected boolean

Constructor Summary

AccessConstructor and Description
public
CopyGroup()

PUBLIC: By default only copy the attributes found in the attribute group and don't null primary keys.

public
CopyGroup(String name)

PUBLIC: By default only copy the attributes found in the attribute group and don't null primary keys.

Method Summary

Modifier and TypeMethod and Description
public void
addAttribute(String
A simple attribute, array or attributes forming a path
attributeNameOrPath
,
CoreAttributeGroup<ATTRIBUTE_ITEM extends CoreAttributeItem, DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>>
- an AttributeGroup to be added.
group
)

Overrides org.eclipse.persistence.core.queries.CoreAttributeGroup.addAttribute.

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.
public void
addAttribute(String attributeNameOrPath, CopyGroup group)

public void
cascadeAllParts()

PUBLIC: Set if the copy should cascade all relationships when copying the object(s).

public void
cascadePrivateParts()

PUBLIC: Set if the copy should cascade only those relationships that are configured as privately-owned.

public void
cascadeTree()

PUBLIC: Set if the copy should cascade only those attributes that are found in the group.

public CopyGroup
clone()

Overrides org.eclipse.persistence.queries.AttributeGroup.clone.

Creates and returns a copy of this object.
public void
dontCascade()

PUBLIC: Set if the copy should not cascade relationships when copying the object(s)

public Map<K, V>
getCopies()

INTERNAL: Get the session.

public int
getDepth()

INTERNAL: Return the cascade depth.

public CopyGroup
getGroup(String attributeNameOrPath)

Overrides org.eclipse.persistence.queries.AttributeGroup.getGroup.

Returns CopyGroup corresponding to the passed (possibly nested) attribute.
public AbstractSession
getSession()

INTERNAL: Return the session.

public boolean
isCopyGroup()

Overrides org.eclipse.persistence.queries.AttributeGroup.isCopyGroup.

INTERNAL: This method is used internally when converting to a copy group.
protected CopyGroup
newGroup(String name, CoreAttributeGroup<ATTRIBUTE_ITEM extends CoreAttributeItem, DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>> parent)

Overrides org.eclipse.persistence.queries.AttributeGroup.newGroup.

Subclass may create different types.
public void
setCopies(Map<K, V> newCopies)

INTERNAL: Set the copies.

public void
setDepth(int newDepth)

INTERNAL: Set the cascade depth.

public void
setSession(AbstractSession newSession)

INTERNAL: Set the session.

public void
setShouldResetPrimaryKey(boolean newShouldResetPrimaryKey)

PUBLIC: Set if the primary key should be reset to null.

public void
setShouldResetVersion(boolean newShouldResetVersion)

PUBLIC: Set if the version should be reset to null.

public boolean
shouldCascade()

PUBLIC: Return true if has been configured to CASCADE_ALL_PARTS or CASCADE_PRIVATE_PARTS.

public boolean
shouldCascadeAllParts()

PUBLIC: Return true if should CASCADE_ALL_PARTS

public boolean
shouldCascadePrivateParts()

PUBLIC: Return true if should CASCADE_PRIVATE_PARTS

public boolean
shouldCascadeTree()

PUBLIC: Return true if should CASCADE_TREE

public boolean
shouldResetPrimaryKey()

PUBLIC: Return if the primary key should be reset to null.

public boolean
shouldResetVersion()

PUBLIC: Return if the version should be reset to null.

protected String
Inherited from org.eclipse.persistence.queries.AttributeGroup:
addAttributefindGroupgetItemisConcurrentisLoadGroupisSupersetOfnewItemnewItemtoCopyGrouptoCopyGrouptoFetchGrouptoFetchGrouptoLoadGrouptoLoadGroup

Field Detail

CASCADE_ALL_PARTSback to summary
public static final int CASCADE_ALL_PARTS

Depth level indicating that all relationships with mappings should be used when building the copied object graph

CASCADE_PRIVATE_PARTSback to summary
public static final int CASCADE_PRIVATE_PARTS

Depth level indicating that only relationships with mapping indicated privately- owned should be copied

CASCADE_TREEback to summary
public static final int CASCADE_TREE

Depth level indicating that only the attributes found in the attribute group should be copied

copiesback to summary
protected Map<K, V> copies
depthback to summary
protected int depth

Policy depth that determines how the copy will cascade to the object's related parts

NO_CASCADEback to summary
public static final int NO_CASCADE

Depth 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

sessionback to summary
protected transient AbstractSession session
shouldResetPrimaryKeyback to summary
protected boolean shouldResetPrimaryKey
shouldResetVersionback to summary
protected boolean shouldResetVersion

Constructor Detail

CopyGroupback to summary
public CopyGroup()

PUBLIC: By default only copy the attributes found in the attribute group and don't null primary keys.

CopyGroupback to summary
public CopyGroup(String name)

PUBLIC: By default only copy the attributes found in the attribute group and don't null primary keys.

Method Detail

addAttributeback to summary
public void addAttribute(String attributeNameOrPath, CoreAttributeGroup<ATTRIBUTE_ITEM extends CoreAttributeItem, DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>> group)

Overrides org.eclipse.persistence.core.queries.CoreAttributeGroup.addAttribute.

Doc from org.eclipse.persistence.core.queries.CoreAttributeGroup.addAttribute.

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);
group.addAttribute("manager.address", group2);
Note that existing group corresponding to attributeNameOrPath will be overridden with the passed group.

Parameters
attributeNameOrPath:String

A simple attribute, array or attributes forming a path

group:CoreAttributeGroup<ATTRIBUTE_ITEM extends CoreAttributeItem, DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>>

- an AttributeGroup to be added.

Annotations
@Override
addAttributeback to summary
public void addAttribute(String attributeNameOrPath, CopyGroup group)
cascadeAllPartsback to summary
public void cascadeAllParts()

PUBLIC: Set if the copy should cascade all relationships when copying the object(s).

cascadePrivatePartsback to summary
public void cascadePrivateParts()

PUBLIC: Set if the copy should cascade only those relationships that are configured as privately-owned.

cascadeTreeback to summary
public void cascadeTree()

PUBLIC: Set if the copy should cascade only those attributes that are found in the group.

cloneback to summary
public CopyGroup clone()

Overrides org.eclipse.persistence.queries.AttributeGroup.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:CopyGroup

a clone of this instance.

Annotations
@Override
dontCascadeback to summary
public void dontCascade()

PUBLIC: Set if the copy should not cascade relationships when copying the object(s)

getCopiesback to summary
public Map<K, V> getCopies()

INTERNAL: Get the session.

getDepthback to summary
public int getDepth()

INTERNAL: Return the cascade depth.

getGroupback to summary
public CopyGroup getGroup(String attributeNameOrPath)

Overrides org.eclipse.persistence.queries.AttributeGroup.getGroup.

Returns CopyGroup corresponding to the passed (possibly nested) attribute.

Annotations
@Override
getSessionback to summary
public AbstractSession getSession()

INTERNAL: Return the session.

isCopyGroupback to summary
public boolean isCopyGroup()

Overrides org.eclipse.persistence.queries.AttributeGroup.isCopyGroup.

Doc from org.eclipse.persistence.queries.AttributeGroup.isCopyGroup.

INTERNAL: This method is used internally when converting to a copy group.

Annotations
@Override
newGroupback to summary
protected CopyGroup newGroup(String name, CoreAttributeGroup<ATTRIBUTE_ITEM extends CoreAttributeItem, DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>> parent)

Overrides org.eclipse.persistence.queries.AttributeGroup.newGroup.

Doc from org.eclipse.persistence.queries.AttributeGroup.newGroup.

Subclass may create different types.

Annotations
@Override
setCopiesback to summary
public void setCopies(Map<K, V> newCopies)

INTERNAL: Set the copies.

setDepthback to summary
public void setDepth(int newDepth)

INTERNAL: Set the cascade depth.

setSessionback to summary
public void setSession(AbstractSession newSession)

INTERNAL: Set the session.

setShouldResetPrimaryKeyback to summary
public void setShouldResetPrimaryKey(boolean newShouldResetPrimaryKey)

PUBLIC: Set if the primary key should be reset to null.

setShouldResetVersionback to summary
public void setShouldResetVersion(boolean newShouldResetVersion)

PUBLIC: Set if the version should be reset to null.

shouldCascadeback to summary
public boolean shouldCascade()

PUBLIC: Return true if has been configured to CASCADE_ALL_PARTS or CASCADE_PRIVATE_PARTS.

shouldCascadeAllPartsback to summary
public boolean shouldCascadeAllParts()

PUBLIC: Return true if should CASCADE_ALL_PARTS

shouldCascadePrivatePartsback to summary
public boolean shouldCascadePrivateParts()

PUBLIC: Return true if should CASCADE_PRIVATE_PARTS

shouldCascadeTreeback to summary
public boolean shouldCascadeTree()

PUBLIC: Return true if should CASCADE_TREE

shouldResetPrimaryKeyback to summary
public boolean shouldResetPrimaryKey()

PUBLIC: Return if the primary key should be reset to null.

shouldResetVersionback to summary
public boolean shouldResetVersion()

PUBLIC: Return if the version should be reset to null.

toStringAdditionalInfoback to summary
protected String toStringAdditionalInfo()

Overrides org.eclipse.persistence.core.queries.CoreAttributeGroup.toStringAdditionalInfo.

INTERNAL:

Annotations
@Override