|
EclipseLink 2.3.2, build 'v20111125-r10461' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.persistence.mappings.DatabaseMapping
org.eclipse.persistence.mappings.AggregateMapping
org.eclipse.persistence.oxm.mappings.XMLObjectReferenceMapping
public class XMLObjectReferenceMapping
TopLink OXM version of a 1-1 mapping. A list of source-target key field associations is used to link the source xpaths to their related target xpaths, and hence their primary key (unique identifier) values used when (un)marshalling. This mapping has a Vector of XMLFields as opposed to a single XMLField. It is important to note that each target xpath is assumed to be set as a primary key field on the target (reference) class descriptor - this is necessary in order to locate the correct target object instance in the session cache when resolving mapping references.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping |
---|
DatabaseMapping.WriteType |
Field Summary | |
---|---|
protected java.util.HashMap |
sourceToTargetKeyFieldAssociations
|
protected java.util.Vector |
sourceToTargetKeys
|
Fields inherited from class org.eclipse.persistence.mappings.AggregateMapping |
---|
referenceClass, referenceClassName, referenceDescriptor |
Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping |
---|
attributeAccessor, attributeName, derivedIdMapping, derivesId, descriptor, fields, isCacheable, isJPAId, isLazy, isMapKeyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, mapsIdValue, NO_FIELDS, NO_WEIGHT, properties, weight, WEIGHT_AGGREGATE, WEIGHT_DIRECT, WEIGHT_TO_ONE, WEIGHT_TRANSFORM |
Constructor Summary | |
---|---|
XMLObjectReferenceMapping()
PUBLIC: The default constructor initializes the sourceToTargetKeyFieldAssociations and sourceToTargetKeys data structures. |
Method Summary | |
---|---|
void |
addSourceToTargetKeyFieldAssociation(java.lang.String srcXPath,
java.lang.String tgtXPath)
PUBLIC: Add a source-target xpath pair to the map. |
void |
addSourceToTargetKeyFieldAssociation(XMLField srcField,
XMLField tgtField)
|
java.lang.Object |
buildFieldValue(java.lang.Object targetObject,
XMLField xmlFld,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Retrieve the target object's primary key value that is mapped to a given source xpath (in the source-target key field association list). |
void |
buildReference(UnmarshalRecord record,
XMLField xmlField,
java.lang.Object object,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Create (if necessary) and populate a reference object that will be used during the mapping reference resolution phase after unmarshalling is complete. |
void |
cascadePerformRemoveIfRequired(java.lang.Object object,
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
java.util.Map visitedObjects)
INTERNAL: Cascade perform delete through mappings that require the cascade |
void |
cascadeRegisterNewIfRequired(java.lang.Object object,
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
java.util.Map visitedObjects)
INTERNAL: Cascade registerNew for Create through mappings that require the cascade |
java.util.Vector |
getFields()
INTERNAL: Return a list of XMLFields based on the source XPath values in the source-target key field associations list. |
XMLInverseReferenceMapping |
getInverseReferenceMapping()
|
protected javax.xml.namespace.QName |
getSchemaType(XMLField xmlField,
java.lang.Object value,
org.eclipse.persistence.internal.sessions.AbstractSession session)
Return a QName representation the schema type for a given XMLField, if applicable. |
protected javax.xml.namespace.QName |
getSingleValueToWriteForUnion(XMLUnionField xmlField,
java.lang.Object value,
org.eclipse.persistence.internal.sessions.AbstractSession session)
Return a single QName representation for a given XMLUnionField, if applicable. |
java.util.HashMap |
getSourceToTargetKeyFieldAssociations()
INTERNAL: Return a list of source-target xmlfield pairs. |
protected java.lang.String |
getValueToWrite(javax.xml.namespace.QName schemaType,
java.lang.Object value,
org.eclipse.persistence.internal.sessions.AbstractSession session)
Return a string representation of a given value, based on a given schema type. |
void |
initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Register a ReferenceResolver as an event listener on the session, if one doesn't already exist. |
boolean |
isObjectReferenceMapping()
INTERNAL: Related mapping should implement this method to return true. |
boolean |
isWriteOnly()
INTERNAL: Some mappings support no attribute (transformation). |
boolean |
isXMLMapping()
INTERNAL: Indicates that this is an XML mapping. |
void |
preInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Allow for initialization of properties and validation. |
java.lang.Object |
readFromRowIntoObject(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
java.lang.Object targetObject,
org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey,
ObjectBuildingQuery sourceQuery,
org.eclipse.persistence.internal.sessions.AbstractSession executionSession,
boolean isTargetProtected)
INTERNAL: Extract the primary key values from the row, then create an org.eclipse.persistence.internal.oxm.Reference instance and store it on the session's org.eclipse.persistence.internal.oxm.ReferenceResolver. |
void |
setAttributeValueInObject(java.lang.Object object,
java.lang.Object value)
INTERNAL: Set the value of the attribute mapped by this mapping. |
void |
setField(org.eclipse.persistence.internal.helper.DatabaseField field)
|
void |
setIsWriteOnly(boolean b)
|
void |
setSourceToTargetKeyFieldAssociations(java.util.HashMap sourceToTargetKeyFieldAssociations)
INTERNAL: Set the list of source-target xmlfield pairs. |
void |
writeFromObjectIntoRow(java.lang.Object object,
org.eclipse.persistence.internal.sessions.AbstractRecord row,
org.eclipse.persistence.internal.sessions.AbstractSession session,
DatabaseMapping.WriteType writeType)
INTERNAL: Write the attribute value from the object to the row. |
void |
writeSingleValue(java.lang.Object value,
java.lang.Object parent,
XMLRecord row,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: A method that marshals a single value to the provided Record based on this mapping's XPath. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.HashMap sourceToTargetKeyFieldAssociations
protected java.util.Vector sourceToTargetKeys
Constructor Detail |
---|
public XMLObjectReferenceMapping()
Method Detail |
---|
public void addSourceToTargetKeyFieldAssociation(java.lang.String srcXPath, java.lang.String tgtXPath)
srcXPath
- tgtXPath
- public void addSourceToTargetKeyFieldAssociation(XMLField srcField, XMLField tgtField)
public java.lang.Object buildFieldValue(java.lang.Object targetObject, XMLField xmlFld, org.eclipse.persistence.internal.sessions.AbstractSession session)
sourceObject
- xmlFld
- session
-
public void buildReference(UnmarshalRecord record, XMLField xmlField, java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
record
- xmlField
- object
- session
- public void cascadePerformRemoveIfRequired(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map visitedObjects)
cascadePerformRemoveIfRequired
in class DatabaseMapping
public void cascadeRegisterNewIfRequired(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map visitedObjects)
cascadeRegisterNewIfRequired
in class DatabaseMapping
public java.util.Vector getFields()
getFields
in class DatabaseMapping
protected javax.xml.namespace.QName getSchemaType(XMLField xmlField, java.lang.Object value, org.eclipse.persistence.internal.sessions.AbstractSession session)
xmlField
- value
-
protected javax.xml.namespace.QName getSingleValueToWriteForUnion(XMLUnionField xmlField, java.lang.Object value, org.eclipse.persistence.internal.sessions.AbstractSession session)
xmlField
- value
-
public java.util.HashMap getSourceToTargetKeyFieldAssociations()
protected java.lang.String getValueToWrite(javax.xml.namespace.QName schemaType, java.lang.Object value, org.eclipse.persistence.internal.sessions.AbstractSession session)
schemaType
- value
-
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
initialize
in class AggregateMapping
DescriptorException
ReferenceResolver
,
NamespaceResolver
public void preInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
DatabaseMapping
preInitialize
in class DatabaseMapping
DescriptorException
public boolean isXMLMapping()
isXMLMapping
in class DatabaseMapping
public java.lang.Object readFromRowIntoObject(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, java.lang.Object targetObject, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected) throws DatabaseException
readFromRowIntoObject
in class DatabaseMapping
DatabaseException
public void setField(org.eclipse.persistence.internal.helper.DatabaseField field)
field
- public void setSourceToTargetKeyFieldAssociations(java.util.HashMap sourceToTargetKeyFieldAssociations)
public void writeFromObjectIntoRow(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType)
writeFromObjectIntoRow
in class DatabaseMapping
public void writeSingleValue(java.lang.Object value, java.lang.Object parent, XMLRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
XMLMapping
writeSingleValue
in interface XMLMapping
value
- - The value to be marshalledrow
- - The Record the value is being marshalled too.public void setIsWriteOnly(boolean b)
setIsWriteOnly
in interface XMLMapping
public boolean isWriteOnly()
DatabaseMapping
isWriteOnly
in interface XMLMapping
isWriteOnly
in class DatabaseMapping
public void setAttributeValueInObject(java.lang.Object object, java.lang.Object value) throws DescriptorException
DatabaseMapping
setAttributeValueInObject
in class DatabaseMapping
DescriptorException
public XMLInverseReferenceMapping getInverseReferenceMapping()
public boolean isObjectReferenceMapping()
DatabaseMapping
isObjectReferenceMapping
in class DatabaseMapping
|
EclipseLink 2.3.2, build 'v20111125-r10461' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |