Top Description Fields Constructors Methods
org.eclipse.persistence.oxm.mappings

public Class XMLBinaryDataMapping

extends XMLDirectMapping
implements BinaryDataMapping<AbstractSession, AttributeAccessor, ContainerPolicy, Converter, ClassDescriptor, DatabaseField, XMLMarshaller, MimeTypePolicy, Session, XMLUnmarshaller, XMLRecord>
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping, org.eclipse.persistence.internal.oxm.mappings.XMLConverterMapping, org.eclipse.persistence.internal.oxm.mappings.Mapping
Imports
jakarta.activation.DataHandler, org.w3c.dom.Element, .Node, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.XMLMarshalException, org.eclipse.persistence.internal.helper.ClassConstants, .DatabaseField, org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.internal.oxm.XMLBinaryDataHelper, .XMLConversionManager, org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping, .Field, org.eclipse.persistence.internal.queries.ContainerPolicy, .JoinedAttributeManager, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.mappings.AttributeAccessor, org.eclipse.persistence.mappings.converters.Converter, org.eclipse.persistence.oxm.NamespaceResolver, .XMLConstants, .XMLDescriptor, .XMLField, .XMLMarshaller, .XMLUnmarshaller, org.eclipse.persistence.oxm.record.DOMRecord, .XMLRecord, org.eclipse.persistence.queries.ObjectBuildingQuery, org.eclipse.persistence.sessions.Session

Purpose:Provide a mapping for binary data that can be treated as either inline or as an attachment.

Responsibilities:

XMLBinaryDataMapping represents a mapping of binary data in the object model to XML. This can either be written directly as inline binary data (base64) or passed through as an MTOM or SWAREF attachment.

The following typed are allowable to be mapped using an XMLBinaryDataMapping:

Setting the XPath: TopLink XML mappings make use of XPath statements to find the relevant data in an XML document. The XPath statement is relative to the context node specified in the descriptor. The XPath may contain path and positional information; the last node in the XPath forms the local node for the binary mapping. The XPath is specified on the mapping using the setXPath method.

Inline Binary Data: Set this flag if you want to always inline binary data for this mapping. This will disable consideration for attachment handling for this mapping.

SwaRef: Set this flag in order to specify that the target node of this mapping is of type xs:swaref

Since
TopLink 11.1.1.0.0g
See Also
org.eclipse.persistence.oxm.attachment.XMLAttachmentMarshaller, org.eclipse.persistence.oxm.attachment.XMLAttachmentUnmarshaller, org.eclipse.persistence.oxm.mappings.MimeTypePolicy

Field Summary

Modifier and TypeField and Description
private static final String
private boolean
private MimeTypePolicy
private boolean
Inherited from org.eclipse.persistence.oxm.mappings.XMLDirectMapping:
isCDATAnullPolicy

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
public String
public MimeTypePolicy
public boolean
public boolean
public boolean
public void
setMimeType(String mimeTypeString)

Implements org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping.setMimeType.

Force mapping to set default FixedMimeTypePolicy using the MimeType string as argument
public void
setMimeTypePolicy(MimeTypePolicy
MimeTypePolicy
aPolicy
)

Implements org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping.setMimeTypePolicy.

Allow implementer to set the MimeTypePolicy class FixedMimeTypePolicy or AttributeMimeTypePolicy (dynamic)
public void
public void
public void
public boolean
public Object
valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed)

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.valueFromRow.

INTERNAL: Return the mapping's attribute value from the row.
public void
writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.writeFromObjectIntoRow.

INTERNAL: Get a value from the object and set that in the respective field of the row.
public void
writeSingleValue(Object
- The value to be marshalled
attributeValue
,
Object parent, XMLRecord
- The Record the value is being marshalled too.
record
,
AbstractSession session)

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.writeSingleValue.

Implements org.eclipse.persistence.internal.oxm.mappings.Mapping.writeSingleValue, org.eclipse.persistence.oxm.mappings.XMLMapping.writeSingleValue.

INTERNAL: A method that marshals a single value to the provided Record based on this mapping's XPath.
Inherited from org.eclipse.persistence.oxm.mappings.XMLDirectMapping:
convertDataValueToObjectValueconvertObjectValueToDataValuegetAttributeValuegetFieldValuegetNullPolicygetXPathinitializeisCDATAisCloningRequiredisCollapsingStringValuesisNormalizingStringValuesisNullValueMarshalledisWriteOnlyisXMLMappingpreInitializesetAttributeValueInObjectsetCollapsingStringValuessetIsCDATAsetIsWriteOnlysetNormalizingStringValuessetNullPolicysetNullValueMarshalledwriteValueIntoRow

Field Detail

includeback to summary
private static final String include
isSwaRefback to summary
private boolean isSwaRef
mimeTypePolicyback to summary
private MimeTypePolicy mimeTypePolicy
shouldInlineBinaryDataback to summary
private boolean shouldInlineBinaryData

Constructor Detail

XMLBinaryDataMappingback to summary
public XMLBinaryDataMapping()

Method Detail

getMimeTypeback to summary
public String getMimeType(Object anObject)

Implements org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping.getMimeType.

INTERNAL

Annotations
@Override
getMimeTypeback to summary
public String getMimeType()

Implements org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping.getMimeType.

INTERNAL

Annotations
@Override
getMimeTypePolicyback to summary
public MimeTypePolicy getMimeTypePolicy()
isAbstractColumnMappingback to summary
public boolean isAbstractColumnMapping()

Overrides org.eclipse.persistence.mappings.foundation.AbstractColumnMapping.isAbstractColumnMapping.

Doc from org.eclipse.persistence.mappings.foundation.AbstractColumnMapping.isAbstractColumnMapping.

INTERNAL:

Annotations
@Override
isAbstractDirectMappingback to summary
public boolean isAbstractDirectMapping()

Overrides org.eclipse.persistence.mappings.foundation.AbstractDirectMapping.isAbstractDirectMapping.

Implements org.eclipse.persistence.internal.oxm.mappings.Mapping.isAbstractDirectMapping.

Doc from org.eclipse.persistence.internal.oxm.mappings.Mapping.isAbstractDirectMapping.

Related mapping should implement this method to return true.

Returns:boolean

Doc from org.eclipse.persistence.core.mappings.CoreMapping.isAbstractDirectMapping.

TODO

Annotations
@Override
isSwaRefback to summary
public boolean isSwaRef()

Implements org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping.isSwaRef.

Annotations
@Override
setMimeTypeback to summary
public void setMimeType(String mimeTypeString)

Implements org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping.setMimeType.

Force mapping to set default FixedMimeTypePolicy using the MimeType string as argument

Annotations
@Override
setMimeTypePolicyback to summary
public void setMimeTypePolicy(MimeTypePolicy aPolicy)

Implements org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping.setMimeTypePolicy.

Allow implementer to set the MimeTypePolicy class FixedMimeTypePolicy or AttributeMimeTypePolicy (dynamic)

Parameters
aPolicy:MimeTypePolicy

MimeTypePolicy

Annotations
@Override
setShouldInlineBinaryDataback to summary
public void setShouldInlineBinaryData(boolean b)

Implements org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping.setShouldInlineBinaryData.

Annotations
@Override
setSwaRefback to summary
public void setSwaRef(boolean swaRef)

Implements org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping.setSwaRef.

Annotations
@Override
setXPathback to summary
public void setXPath(String xpathString)

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.setXPath.

Implements org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping.setXPath, org.eclipse.persistence.internal.oxm.mappings.DirectMapping.setXPath.

Set the Mapping field name attribute to the given XPath String

Parameters
xpathString:String

String

Annotations
@Override
shouldInlineBinaryDataback to summary
public boolean shouldInlineBinaryData()

Implements org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping.shouldInlineBinaryData.

Annotations
@Override
valueFromRowback to summary
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed)

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.valueFromRow.

Doc from org.eclipse.persistence.oxm.mappings.XMLDirectMapping.valueFromRow.

INTERNAL: Return the mapping's attribute value from the row. The execution session is passed for the case of building a UnitOfWork clone directly from a row, the session set in the query will not know which platform to use for converting the value. Allows the correct session to be passed in.

Annotations
@Override
writeFromObjectIntoRowback to summary
public void writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.writeFromObjectIntoRow.

Doc from org.eclipse.persistence.oxm.mappings.XMLDirectMapping.writeFromObjectIntoRow.

INTERNAL: Get a value from the object and set that in the respective field of the row.

Annotations
@Override
writeSingleValueback to summary
public void writeSingleValue(Object attributeValue, Object parent, XMLRecord record, AbstractSession session)

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.writeSingleValue.

Implements org.eclipse.persistence.internal.oxm.mappings.Mapping.writeSingleValue, org.eclipse.persistence.oxm.mappings.XMLMapping.writeSingleValue.

Doc from org.eclipse.persistence.oxm.mappings.XMLMapping.writeSingleValue.

INTERNAL: A method that marshals a single value to the provided Record based on this mapping's XPath. Used for Sequenced marshalling.

Parameters
attributeValue:Object

- The value to be marshalled

record:XMLRecord

- The Record the value is being marshalled too.

Annotations
@Override